C
C#11mo ago
2fur

❔ Trying to use System.drawing.common 6.0.0 on Linux. Why it doesnt work?

hello, I'm using System.Drawing.Common version 6.0.0 because I read that it should support linux. I changed the runtimeconfig.json as recommended on the microsoft website, but it still doesn't work. I tried this solution: learn.microsoft.com/pl-pl/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only And this is what my json looks like:
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0",
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
}
}
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0",
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
}
}
The error I get: The type initializer for 'Gdip' threw an exception. System.Func'1[System.Exception] at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, int32 stride , Int32 format, IntPtr scan0, IntPtr& bitmap) at ProtogenTheBot.commands.com_2.punishment(CommandContext ctx, String options) in D:\Vs projects\ProtogenTheBot\commands\com_2.cs:line 236 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() at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize() at System.Drawing.SafeNativeMethods.Gdip..cctor() Please help me solve the problem. Thank you in advance
5 Replies
Jimmacle
Jimmacle11mo ago
like the page says, it's not supported so if it doesn't work you're out of luck you should switch to one of the other libraries it lists but your runtimeconfig has the options in the wrong place in the file
2fur
2fur11mo ago
please tell me what it should look like correctly. It can solve my problem in some way i should place configPropeties below framework? something like that?
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
}
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
}
Jimmacle
Jimmacle11mo ago
yes, that's how the page says to do it
reflectronic
reflectronic11mo ago
your configProperties is in the wrong place look at the example in the documentation. it is outside of the runtimeOptions element, not inside of it https://learn.microsoft.com/en-us/dotnet/core/runtime-config/#example-appnameruntimeconfigjson-file oh, i see i should have scrolled down
Accord
Accord11mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ ✅ My code is pretty close to the right solution, but one test case still failsSo I have this solution for LeetCode's bulls and cows puzzle https://leetcode.com/problems/bulls-and❔ Has anyone worked on PUBNUB c# sdk?Need inputs on publishing and subscribing. Please help❔ Reordering of columns: (DevExpress/XAML)How should I go about switching the order of these columns? I tried the following but did not work: ❔ When using AbstractValidator, is there any way that i can override the http status code?Im trying to return a 422 HTTP Status code when the error occurs, but by default it returns a 400 Ba❔ Best way to structure MVVM WPF App for multiples popupsHi ! I have a (nooby) WPF question. So I'm using MVVM paterns Here is my folder structure: ``` /MVVM❔ anyone uses/used/run splashkit on visual studio from iOS/MacBooks?Or any recommendation on tutorials ? Most tutorials I’ve seen were on windows and lowkey getting con❔ Whats the fastest way to write this data to a file? (C# Console App.)I need to write an int[][] to disk. Each int[] has 2 values, and the full int[][] has 100mil entries❔ Thin/Thick UI DesignHi! I've been a longtime c#.net programmer at a corporate office. I've been wanting to do some side Visual Studio project reference not updating with new codeBasically I have 2 projects in separate solutions, API and Data (the projects) API usually reference✅ HTTP Error 500.30 - ASP.NET Core app failed to startHello! I'm getting this error after deploying a net core app to IIS 10 (Windows 10 pc). Publish se