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

Stifu stifu at free.fr
Wed Nov 28 08:56:05 UTC 2012

WinForms works the worst on Mac. Although I don't have a Mac, I recommend the
users of my WinForms app to run their app this way, and it seems to work
fine for them: "MONO_MWF_MAC_FORCE_X11=1 mono yourapp.exe"
That makes it so it runs the app using the X11 driver rather than the Mac
(Carbon) one, which means the app should work as well as on Linux. The only
problem is that it requires an X11 server to be installed on the Mac.

jeff clausius wrote
> 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();
> f2.ShowDialog();
> f2.Dispose();
> 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
> 2010.
> 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.
> ^C
> 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.
> TIA,
> Jeff Clausius
> _______________________________________________
> Mono-list maillist  -  

> Mono-list at .ximian

> http://lists.ximian.com/mailman/listinfo/mono-list

View this message in context: http://mono.1490590.n4.nabble.com/Windows-Forms-App-under-Mac-OS-X-Mono-tp4657557p4657560.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list