Bug 24183 - Race condition with libgdiplus: System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.KnownColors
Summary: Race condition with libgdiplus: System.TypeInitializationException: An except...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: libgdiplus ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-31 02:05 UTC by Eric Roller
Modified: 2014-10-31 02:07 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
log output with MONO_LOG_LEVEL=debug (388.49 KB, text/plain)
2014-10-31 02:06 UTC, Eric Roller
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 24183 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Eric Roller 2014-10-31 02:05:27 UTC
I have compiled mono 3.10.0 (same issue with mono 3.8) with the latest libgdiplus library on x86_64 centos 6. Occassionally I get a System.TypeInitializationException during a call to Color.Red. It seems like a race condition during static initialization since it happens intermittently.

Full exception is:


System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.KnownColors ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus
  --- End of inner exception stack trace ---
  at System.Drawing.KnownColors..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Drawing.Color.get_Red () [0x00000] in <filename unknown>:0 



Note that this does not seem to be an issue with correctly loading the libgdiplus.so file as I have seen in other bug reports related to libgdiplus. 

Full log with MONO_LOG_LEVEL=debug set attached.

I have run this using mono 2.10.9 with an older libgdiplus library and have not encountered this issue.
Comment 1 Eric Roller 2014-10-31 02:06:28 UTC
Created attachment 8571 [details]
log output with MONO_LOG_LEVEL=debug