System.Drawing.Common is targeted at Windows only #732

Closed
opened 2026-01-29 16:47:13 +00:00 by claunia · 3 comments
Owner

Originally created by @danatcofo on GitHub (Dec 9, 2021).

This is related to forward support for .net 6 as added in #636.

The issue is that System.Drawing.Common isn't fully cross platform supported so while it won't break on every system its not stable for all use-cases. The issue is described by Microsoft here

This issue doesn't really present within the .net 5 ecosystem but will likely cause issues going forward. Microsoft recommends the following alternatives.

We need to use one of these repos or a suitable equivalent as appropriate and update usages within NativeImage.cs as appropriate.

Feedback on replacements welcome.

Originally created by @danatcofo on GitHub (Dec 9, 2021). This is related to forward support for .net 6 as added in #636. The issue is that System.Drawing.Common isn't fully cross platform supported so while it won't break on every system its not stable for all use-cases. The issue is described by Microsoft [here](https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only) This issue doesn't really present within the .net 5 ecosystem but will likely cause issues going forward. Microsoft recommends the following alternatives. * [ImageSharp](https://github.com/SixLabors/ImageSharp) * [SkiaSharp](https://github.com/mono/SkiaSharp) * [Microsoft.Maui.Graphics](https://github.com/dotnet/Microsoft.Maui.Graphics) We need to use one of these repos or a suitable equivalent as appropriate and update usages within [NativeImage.cs](https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.API/Entities/NativeImage.cs) as appropriate. Feedback on replacements welcome.
claunia added the bug label 2026-01-29 16:47:13 +00:00
Author
Owner

@bman46 commented on GitHub (Dec 10, 2021):

I spent a bit of time looking into this and it appears that ImageSharp doesn't support bitmaps. Maui is in prerelease and doesn't really have any documentation. SkiaSharp seems pretty good but it won't be a drop in replacement and will break compatibility.

Edit: ImageSharp supports bitmaps but not portable bitmaps. So it would likely be a candidate.

@bman46 commented on GitHub (Dec 10, 2021): I spent a bit of time looking into this and it appears that [ImageSharp doesn't support bitmaps](https://github.com/SixLabors/ImageSharp/pull/1851). Maui is in prerelease and doesn't really have any documentation. SkiaSharp seems pretty good but it won't be a drop in replacement and will break compatibility. Edit: ImageSharp supports bitmaps but not portable bitmaps. So it would likely be a candidate.
Author
Owner

@danatcofo commented on GitHub (Dec 10, 2021):

Maui has been prerelease for 10 years and still gets regularly updated. According to the Maui docs it's used internally in MS many places. I think I would be ok with it.

@danatcofo commented on GitHub (Dec 10, 2021): Maui has been prerelease for 10 years and still gets regularly updated. According to the Maui docs it's used internally in MS many places. I think I would be ok with it.
Author
Owner

@antonfirsov commented on GitHub (Dec 13, 2021):

PBM is a very special and rare format being implemented as a community contribution in the mentioned PR. Otherwise, ImageSharp is pretty much feature feature complete and stable.

The optimal choice depends on the services implemented by the NativeImage infrastructure. To me it looks like it mostly deals with encoding/decoding, offscreen resize/crop, serialization/deserialization (for clipboard services?). ImageSharp is good and performant at those things when targeting Desktop platforms powered by coreclr. I can help with potential adaption.

@antonfirsov commented on GitHub (Dec 13, 2021): PBM is a very special and rare format being implemented as a community contribution in the mentioned PR. Otherwise, ImageSharp is pretty much feature feature complete and stable. The optimal choice depends on the services implemented by the `NativeImage` infrastructure. To me it looks like it mostly deals with encoding/decoding, offscreen resize/crop, serialization/deserialization (for clipboard services?). ImageSharp is good and performant at those things when targeting Desktop platforms powered by coreclr. I can help with potential adaption.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#732