AdvancedSharpAdbClient icon indicating copy to clipboard operation
AdvancedSharpAdbClient copied to clipboard

Cannot implicitly convert type 'AdvancedSharpAdbClient.Models.Framebuffer' to 'System.Drawing.Image'

Open luronumen opened this issue 11 months ago • 11 comments

Describe the bug

It is not possible convert implicitly convert type 'AdvancedSharpAdbClient.Models.Framebuffer' to 'System.Drawing.Image' when build using .NET 8.0.

Steps to reproduce the bug

Try implicitly convert type 'AdvancedSharpAdbClient.Models.Framebuffer' to 'System.Drawing.Image' using 'AdvancedSharpAdbClient for .NET 8.0:

var deviceData = AdbClient.GetDevices().First(x => x.Serial == serial); var adbClient = new AdbClient(); var image = (Image)adbClient.GetFrameBuffer(deviceData);

Expected behavior

It should be possible convert implicitly convert type 'AdvancedSharpAdbClient.Models.Framebuffer' to 'System.Drawing.Image' like it is possible to do when build using .NET Framework 4.8.1.

Screenshots

image

NuGet package version

3.1.10

.NET Platform

.NET 8

Platform type

Windows

System version

Windows 11 x64

IDE

Visual Studio 2022

Additional context

This issue is NOT reproducible when build using .NET Framework 4.8.1.

luronumen avatar Mar 14 '24 01:03 luronumen

Because it need System.Drawing.Common and I removed it because it only supports Windows since .NET 7. You can change target to net8.0-windows10.0.17763.0.

wherewhere avatar Mar 14 '24 04:03 wherewhere

Hi @wherewhere

Thank you very much for your prompt reply!

I have replaced:

<TargetFramework>net8.0-windows</TargetFramework>

by:

<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>

And this issue is not reproducible.

Is there any plan to remove System.Drawing.Common dependency once that it is now Windows Only?

Thanks in advanced, Luciano

luronumen avatar Mar 14 '24 05:03 luronumen

But System.Drawing.Common is a part of desktop extension. .net-windows does not contains it...

wherewhere avatar Mar 14 '24 05:03 wherewhere

But System.Drawing.Common is a part of desktop extension. .net-windows does not contains it...

If so, why not support the System.Drawing.Common for net8.0-windows fully instead of net8.0-windows10.0.17763.0 only if it is part of desktop extension?

luronumen avatar Mar 14 '24 05:03 luronumen

Because I also add the supports for WinRT like this: https://github.com/SharpAdb/AdvancedSharpAdbClient/blob/main/AdvancedSharpAdbClient/SyncService.Async.cs#L205-L379

wherewhere avatar Mar 14 '24 05:03 wherewhere

You can create an extension with this codes by yourself. https://github.com/SharpAdb/AdvancedSharpAdbClient/blob/main/AdvancedSharpAdbClient%2FModels%2FFramebufferHeader.cs#L270-L418

wherewhere avatar Mar 14 '24 05:03 wherewhere

https://gist.github.com/wherewhere/bcbab80a9460aad8fd14655c15c76cba

wherewhere avatar Mar 22 '24 10:03 wherewhere

https://gist.github.com/wherewhere/bcbab80a9460aad8fd14655c15c76cba

Hi @wherewhere

Do you have any plan to add this implementation in the next AdvancedSharpAdbClient package to make it is possible to convert the Framebuffer to System.Drawing.Image on net8.0-windows?

Thanks in advance, Luciano

luronumen avatar Apr 01 '24 17:04 luronumen

No

wherewhere avatar Apr 01 '24 17:04 wherewhere

No

If so, could you please update the README documentation to say that this is not working when use the net8.0-windows as TargetFramework:

https://github.com/SharpAdb/AdvancedSharpAdbClient#getting-a-screenshot

luronumen avatar Apr 01 '24 23:04 luronumen

https://github.com/SharpAdb/AdvancedSharpAdbClient/wiki/Compatibility

wherewhere avatar Apr 02 '24 16:04 wherewhere