[Mono-list] Windows Forms App under Mac OS X Mono

jeff clausius jeffc at sourcegear.com
Wed Nov 28 01:23:28 UTC 2012

I'm investigating Mono as a possible solution for porting a Windows
Forms based app to OS X.

As a test, I've created a small C# app.  The Main form contains a button
which invokes another window with the following code in the _Click() event:

Form2 f2 = new Form2();

Form2 has a button which just calls "Close();"

No other real code in the test app.

I'm running into problems on a Mac OS X Lion (10.7.5) computer, I've
installed/tested the app against Mono SDK 2.10.9 and 3.0.1.  I've also
tried binaries compiled with MonoDevelop (3.0.5) as well as one from VS

Testing involves clicking Form1's Button #1 (to show Form2) and Button
#2 (on Form 2) to close Form2.  Clicking these buttons over and over
eventually causes the mono app to bring up 3 to 5 simultaneous Form2s.
The "topmost" Form2 is the normal one w/ default coloring and Button #2.
 However, the underneath dialogs are "blank" windows w/ a white
background and no layout of any kind for Button #2.  You cannot even
close these forms w/ the "X" close button.

After this occurs, if I close Form1, the mono process hangs, and Ctrl-C
is req'd to kill the process.

Also, the following is displayed in the shell which launched the app:

user$ mono WindowsFormsMonoTest.exe
Nov 27 18:35:16 comp-lion.local mono[210] <Error>:
kCGErrorInvalidConnection: CGSGetWindowTags: Invalid connection
Nov 27 18:35:16 comp-lion.local mono[210] <Error>: kCGErrorFailure: Set
a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

Has anyone seen this before?  Seems like a simple case which should work
under Mac OS X.  Can anyone suggest possible solutions?  Is it a
mismatch between X11 and/or GTK versions and Mono?  Any other
possibilities?  BTW, I have the sample source if anyone would like to
see this firsthand.

Jeff Clausius

More information about the Mono-list mailing list