[Mono-list] Possible Mac OS X bugs?

jeff clausius jeffc at sourcegear.com
Tue Dec 4 16:33:31 UTC 2012

I've been trying to coax a System.Windows.Forms app to run on Mac OS X.
 From some suggestions of others responding to request on this list, I'm
experimenting with setting the "MONO_MWF_MAC_FORCE_X11=1" env. var. and
running the app.

Note, to get this far, I had to first get GTK for 32-bit.  I chose to
use Mac Ports (getting gtk2 for i386).

So, the following are issues I encountered.  Can anyone let me know if
these are bugs and should be reported to Xamarin?

A)  I had to change the dll mapping of "libX11" to
"/opt/X11/lib/libX11.dylib" in the mono 'config' file.  While I do not
believe this is necessarily a bug, it is required in order to get
MONO_MWF_MAC_FORCE_X11 to work.  Note, I didn't try setting
DYLD_LIBRARY_PATH, but that may be another option.

B) X11DesktopColors.cs is hard coded to use "libgtk-x11-2.0.so.0" for
libgdk and libgtk.  While this works on Linux, within Mac OSX, the
naming convention is "dylib" for library extensions.  I got around this
by using a <dllmap> entry, but was wanting to know if this was a bug
regarding the hard coded filename within X11DesktopColors.cs.

C) Missing functions in libgdiplus.  When MONO_MWF_MAC_FORCE_X11 is
used, some of the *_linux() methods will be called from
gdipFunctions.cs.  For example, GdipCreateFromXDrawable_linux().

However, the Mac version of libgdiplus (libgdiplus.dylib) which ships
with the mono binaries must have been compiled w/ out these methods.
Running a System.Windows.Forms app with the MONO_MWF_MAC_FORCE_X11 var
set will cause the following error:

Unhandled Exception:
System.ArgumentException: A null reference or invalid value was found
System.EntryPointNotFoundException: GdipCreateFromXDrawable_linux
  at (wrapper managed-to-native)
System.Drawing.GDIPlus:GdipCreateFromXDrawable_linux (intptr,intptr,intptr&)
  at System.Drawing.Graphics.FromXDrawable (IntPtr drawable, IntPtr
display) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0x00000] in
<filename unknown>:0
  at System.Windows.Forms.XplatUIX11.GetAutoScaleSize
(System.Drawing.Font font) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.XplatUI.GetAutoScaleSize (System.Drawing.Font
font) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Form.GetAutoScaleSize (System.Drawing.Font
font) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0
  at WindowsFormsApplicationMono1.Form1..ctor () [0x00000] in <filename
  at (wrapper remoting-invoke-with-check)
WindowsFormsApplicationMono1.Form1:.ctor ()
  at WindowsFormsApplicationMono1.Program.Main () [0x00000] in <filename


More information about the Mono-list mailing list