Bug 10302 - Fatal error in System.Windows.Forms.Control constructor in 3.0.3
Summary: Fatal error in System.Windows.Forms.Control constructor in 3.0.3
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: master
Hardware: PC Windows
: Lowest normal
Target Milestone: Community
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-02-14 12:32 UTC by Scott Stephens
Modified: 2017-09-01 11:56 UTC (History)
3 users (show)

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

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 10302 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 Scott Stephens 2013-02-14 12:32:11 UTC
This is true in Mono 3.0.3, not sure about trunk, is NOT there in 2.10.9.

Create following source in Program.cs:

using System;
using System.Windows.Forms;

namespace MonoWindowsFormsBug
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Control c = new Control();
			Console.ReadLine();
		}
	}
}

Compile with:

"C:\Program Files (x86)\Mono-3.0.3\bin\mcs.bat" -r:System.Windows.Forms -out:Program.exe -g Program.cs

Run with:

"C:\Program Files (x86)\Mono-3.0.3\bin\mono.exe" --debug Program.exe

The result will be:

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.Type
InitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeWin32Classic ---> 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.DllNotFoundException: /tmp/install/lib/libgdiplus.so
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000cc] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\gdipFunctions.cs:127
  --- End of inner exception stack trace ---
  at System.Drawing.KnownColors..cctor () [0x0001a] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\KnownColors.cs:225
  --- End of inner exception stack trace ---
  at System.Drawing.Color.get_Black () [0x00000] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\Color.cs:483
  at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\ThemeWin32Classic.cs:52
  --- End of inner exception stack trace ---
  at System.Windows.Forms.ThemeEngine..cctor () [0x0003c] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\ThemeEngine.cs:51
  --- End of inner exception stack trace ---
  at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.F
orms\SystemInformation.cs:317
  at System.Windows.Forms.Control..ctor () [0x000e3] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:900
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000]
 in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\WindowsFormsSynchronizationContext.cs:45
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Control..ctor () [0x00014] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:871
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at MonoWindowsFormsBug.MainClass.Main (System.String[] args) [0x00001] in C:\Users\rock361\Development\temporary\MonoWindowsFormsBug\MonoWindowsFormsBug\Progr
am.cs:10
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSync
hronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.Typ
eInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeWin32Classic ---> 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.DllNotFoundException: /tmp/install/
lib/libgdiplus.so
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000cc] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\gdipFunctions.cs:127
  --- End of inner exception stack trace ---
  at System.Drawing.KnownColors..cctor () [0x0001a] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\KnownColors.cs:225
  --- End of inner exception stack trace ---
  at System.Drawing.Color.get_Black () [0x00000] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\Color.cs:483
  at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\ThemeWin32Classic.cs:52
  --- End of inner exception stack trace ---
  at System.Windows.Forms.ThemeEngine..cctor () [0x0003c] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\ThemeEngine.cs:51
  --- End of inner exception stack trace ---
  at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\SystemInformation.cs:317
  at System.Windows.Forms.Control..ctor () [0x000e3] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:900
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\WindowsFormsSynchronizationContext.cs:45
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Control..ctor () [0x00014] in C:\cygwin\sources\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:871
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at MonoWindowsFormsBug.MainClass.Main (System.String[] args) [0x00001] in C:\Users\rock361\Development\temporary\MonoWindowsFormsBug\MonoWindowsFormsBug\Program.cs:10


It works if you run with 
"C:\Program Files (x86)\Mono-2.10.9\bin\mono.exe" --debug Program.exe, even when compiled with the 3.0.3 compiler.
Comment 1 tommy 2013-02-26 02:31:30 UTC
i have the same problem, all of my programm are unable to run whtith mono 3.0.x
Comment 2 Scott Stephens 2013-03-06 11:44:11 UTC
Still a problem in Mono 3.0.6
Comment 3 Hin-Tak Leung 2014-11-09 06:11:59 UTC
This is the same as Bug 24269 -
dllmap for gdiplus wrong on the windows mono 3.2.3 installer.

I posted a fix there.