Bug 8123 - Unable to run WinForms apps on Mono 3.0 Mac with MONO_MWF_MAC_FORCE_X11=1
Summary: Unable to run WinForms apps on Mono 3.0 Mac with MONO_MWF_MAC_FORCE_X11=1
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: unspecified
Hardware: PC Mac OS
: Lowest normal
Target Milestone: Community
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-31 19:40 UTC by Latif Khalifa
Modified: 2017-09-01 11:55 UTC (History)
4 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 8123 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 Latif Khalifa 2012-10-31 19:40:57 UTC
Trying to run a WinForms app on a Mac with Mono 3.0, I get the following exception:

Unhandled System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.DllNotFoundException: libX11.dylib
  at (wrapper managed-to-native) System.Windows.Forms.XplatUIX11:XInitThreads ()
  at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in <filename unknown>:0 
  at Radegast.MainProgram.RunRadegast (System.String[] args) [0x00000] in <filename unknown>:0 
  at Radegast.MainProgram.Main (System.String[] args) [0x00000] in <filename unknown>:0 : An exception was thrown by the type initializer for System.Windows.Forms.XplatUI
  at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in <filename unknown>:0 
  at Radegast.MainProgram.RunRadegast (System.String[] args) [0x00000] in <filename unknown>:0 
  at Radegast.MainProgram.Main (System.String[] args) [0x00000] in <filename unknown>:0 

The application can be downloaded from:
https://files.streamgrid.net/radegast/radegast-2.7-dev-osx-x11.zip

I used it on 2.10.4 without problems with MONO_MWF_MAC_FORCE_X11=1.
Comment 1 Latif Khalifa 2012-10-31 22:09:55 UTC
Editing /Library/Frameworks/Mono.framework/Home/etc/mono/config and changing line:

    <dllmap dll="libX11" target="libX11.dylib" os="!windows" />

to

    <dllmap dll="libX11" target="/usr/X11R6/lib/libX11.dylib" os="!windows" />

fixes issue number one. The new next issue is:

    System.EntryPointNotFoundException: GdipCreateFromXDrawable_linux
Comment 2 IJsbrand Oudshoorn 2013-10-22 14:07:13 UTC
This issue doesn't seems to be solved still. It is in 3.2.3 also.

Please have a look on http://list-archives.org/2012/12/04/mono-list-lists-ximian-com/possible-mac-os-x-bugs/f/7215941674 too.

1. The config file is missing a map for libgtk-x11-2.0.so.0
2. The *.dylib files seems to be missing the *_linux functions that are used by the X11 implementation.
Comment 3 Latif Khalifa 2013-12-07 07:54:21 UTC
You can get around X11 and Gtk# library issues with:

export DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib:/usr/X11R6/lib:$DYLD_FALLBACK_LIBRARY_PATH:/usr/lib"

before running mono. There is no workaround for libgdi.dylib being built without X11 support.

Last known good build of mono can be downloaded from:

http://download.mono-project.com/archive/2.10.9/macos-10-x86/12/MonoFramework-MDK-2.10.9_12.macos10.xamarin.x86.dmg
Comment 4 Carlos Dominguez 2014-01-21 17:24:52 UTC
Hi, I was facing the same issue stated in this bug and was able to solve it with the recommendations here and on: http://list-archives.org/2012/12/04/mono-list-lists-ximian-com/possible-mac-os-x-bugs/f/7215941674.

I do however still have the issue with context menus that was mentioned in that link. I was wondering if there's already a fix or workaround for it too? Thank you in advance.
Comment 5 Carlos Dominguez 2014-01-23 16:32:10 UTC
Just FYI for my purposes I just did a workaround were I handle the Click event of the ToolStripDropDownButton and then do DropDown.BringToFront();