SharpAdb / AdvancedSharpAdbClient

AdvancedSharpAdbClient is a .NET library that allows .NET, Mono and Unity applications to communicate with Android devices. It's improved version of SharpAdbClient.
https://sharpadb.github.io
Apache License 2.0
185 stars 53 forks source link

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

Open luronumen opened 6 months ago

luronumen commented 6 months ago

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.

wherewhere commented 6 months ago

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.

luronumen commented 6 months ago

Hi @wherewhere

Thank you very much for your prompt reply!

I have replaced:

\net8.0-windows\

by:

\net8.0-windows10.0.17763.0\

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

wherewhere commented 6 months ago

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

luronumen commented 6 months ago

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?

wherewhere commented 6 months ago

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

wherewhere commented 6 months ago

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

wherewhere commented 5 months ago

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

luronumen commented 5 months ago

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

wherewhere commented 5 months ago

No

luronumen commented 5 months ago

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

wherewhere commented 5 months ago

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