[Mono-osx] error trying to use winforms

Ryan J. Evans rje at mutekicorp.com
Tue Oct 31 17:03:42 EST 2006

Hi everyone,

I'm trying to follow the winforms tutorial listed here:


and I can get all the way through the macpack command okay.  When I  
run the app though, I get the following error:

Unhandled Exception: System.TypeInitializationException: An exception  
was thrown by the type initializer for System.Windows.Forms.XplatUI  
---> System.ArgumentNullException: Could not open display (X-Server  
required. Check you DISPLAY environment variable)
Parameter name: Display
   at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr  
display_handle) [0x00000]
<clipped for brevity>

So, I thought adding these two lines to the script that macpack  
creates might help:
open -a X11
export DISPLAY=:0.0

But then on running again I get this error:
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.


   at (wrapper managed-to-native)  
System.Drawing.Carbon.CreateCGContextForPort (intptr,intptr&) <0x00004>
   at (wrapper managed-to-native)  
System.Drawing.Carbon.CreateCGContextForPort (intptr,intptr&)  
   at System.Drawing.Carbon.GetCGContextForView (intptr) <0x00073>
   at System.Drawing.Graphics.FromHwnd (intptr) <0x000c1>
   at System.Windows.Forms.XplatUIX11.PaintEventStart (intptr,bool)  
   at System.Windows.Forms.XplatUI.PaintEventStart (intptr,bool)  
<clipped for brevity>

Any suggestions you may have would be appreciated.  I'm running mono  
1.1.18 on os x 10.4.8 on an intel mac.


More information about the Mono-osx mailing list