We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TypeInitializationException:The type initializer for 'Gdip' threw an exception

I’m building an application that runs on both windows and macos.

This application converts dng to bmp.

On Windows (10) it works but on MacOs I get:

TypeInitializationException:The type initializer for ‘Gdip’ threw an exception.

We’re using the latest AsposeImaging and the app is built in .net 6.

See code example:

@nielsbosma
The issue and recommended solution for NET6 is described here : https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only.

Following references may help as well:


https://www.nuget.org/packages/runtime.osx.10.10-x64.CoreCompat.System.Drawing/

This doesn’t work. I’ve tried:

  • Installing mono-libgdiplus
  • Adding the nugetpackage runtime.osx.10.10-x64.CoreCompat.System.Drawing
  • Adding a “runtimeconfig.template.json” file with:

{
“configProperties”: {
“System.Drawing.EnableUnixSupport”: true
}
}

@nielsbosma
Thank you for feedback. We’ve created internal ticket IMAGINGNET-5481 to investigate the issue from our side. It’s attached to the issue to let you see the progress.