-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.Drawing.Common is not supported on non-Windows platforms #80148
Comments
The exception message is correct: System.Drawing.Common is no longer supported on .Net 6 on Linux and macOS. For more information, see this document and dotnet/docs#25257. As that document states, if you want to continue using it on .Net 6, you can provide a runtime config switch named As for the aka.ms link, I'm not sure. Maybe it will be set up once this breaking change is properly documented (i.e. when dotnet/docs#25367 is merged). |
It seems @svick has answered your question, so I’m closing this issue. Let me know if I missed anything. |
Reopening since the link goes to our internal tool somehow. |
I'll work with @gewarren to post the doc ASAP on Monday and point the url to the doc. |
@safern Here is the PR; it's ready for review: dotnet/docs#25367 |
https://aka.ms/systemdrawingnonwindows should now resolve to the published docs. Thanks for the report. |
What is the solution for this for developers?
So now developers will use multiple libraries and .NET will have no standard image manipulation API at all? What is the suggested solution for Blazor WebAssembly projects needing to resize image before uploading to server? MAUI graphics API? Thanks |
@mattleibow can you confirm that SkiaSharp is fully supported by Microsoft? Also, I have generally thought of SkiaSharp as client focused, and something like ImageSharp better for servers. Is it reasonable to use SkiaSharp on the server side? I know that unlike ImageSharp, it has some native dependencies. |
I am using
but still seeing this exception:
can anyone help please? |
@siddjain Which file are those settings from? |
the settings are from |
What does your project file look like? I'm surprised the output folder is net6.0-windows on macOS. |
its because I have set it so. setting it to
|
Looks like you're using the 7.0 version of System.Drawing.Common. Does it work if you set that to 6.0.0? |
no it still doesn't work
|
made some changes and that error is fixed but I get a new one now:
how do I fix this one? |
@siddjain for that specific error you need to make sure that https://www.mono-project.com/docs/gui/libgdiplus/ In Unix systems you can do it by running on mac systems you need to run Note that using 6.0.0 means that you'd be out of support so the recommended guidelines from the .NET team is to move out of depending on System.Drawing.Common for non windows. |
@mattleibow just checking you saw my question above as it would be good to know the answer. |
@siddjain do you have to use System.Drawing? As mentioned, it is out of support now. |
Thanks all for the help. re: do you have to use System.Drawing? to answer literally, its a loaded question. One can always port the code to another library. In fact, I already did it for one of my GDI+ apps as I wanted to learn Swift but to my surprise the C# code runs much faster than Swift! Also what I understand when someone says the library is out of support is that no one is fixing bugs and issues but anyone is welcome to use it as-is and it will continue to be available and downloadable from the internet. is that correct? |
System.Drawing is not going anywhere, but the code inside it that uses libgdiplus has been removed, which means that it will only work on Windows now.
.NET 6 will go out of support in due course, although you'll still be able to download it if you don't mind being out of support. In short, I recommend you don't write code against System.Drawing unless it's only intended to run on Windows. The only exception might be if it's just a temporary thing, in which case you can use .NET 6. But generally you should pick another library to do this stuff unless you're Windows only. |
Thanks Dan for the clarification! |
This part is not magically for free you know especially with large codebase with little automatic tests |
Reading it all I came to the conclusion that I learned not the right programming language. It was necessary to learn Java 10 years ago when C# finished with such valuable problems. Microsoft is a great company but it is not able to make support graphics basics for three OS. I will keep silent about cross-platformed desktop GUI, they are missing. Miguel De Icaza come back. If you advise migrating to MAUI or Skia, maybe will you write a wrapper for it inside Linux System.Drawing implementation? |
System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.
at System.Drawing.LibraryResolver.EnsureRegistered() in System.Drawing.Common.dll:token 0x600058c+0x11
at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize() in System.Drawing.Common.dll:token 0x6000b00+0x0
at System.Drawing.SafeNativeMethods.Gdip..cctor() in System.Drawing.Common.dll:token 0x6000af8+0x2b
https://aka.ms/systemdrawingnonwindows can't be open,How to solve this problem
The text was updated successfully, but these errors were encountered: