Upon debugging my Android .NET MAUI application I get the message on the app startup:
.NET MAUI: System.TypeInitializationException: 'The type initializer for 'Gdip' threw an exception'
and the app crashes. Call stack does not have any helpful info:
I do not use System.Drawing.Common in my application as it is not compatible.
How can I fix this issue?
In your MAUI Application project, at the project root level add the file runtimeconfig.template.json
.
the file should contain this json:
{
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
After that clean and rebuild the project.