42523

MAC: Mono Helloworld example

Question:

I did a fresh install of Mono on my OSX Yosemite and tried the examples on <a href="http://www.mono-project.com/docs/getting-started/mono-basics/" rel="nofollow">http://www.mono-project.com/docs/getting-started/mono-basics/</a>.

The Console Hello World example runs without problem but when I tried the WindowsForm Hello World, I got the following error :

System.EntryPointNotFoundException: GdipCreateFromContext_macosx at (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreateFromContext_macosx (intptr,int,int,intptr&) at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0x00000] in <filename unknown>:0 at System.Windows.Forms.XplatUICarbon.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0 at System.Windows.Forms.XplatUI.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.ScrollableControl. at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0 Chads-MacBook-Pro:C# ChadLeong$ mono hello.exe System.EntryPointNotFoundException: GdipCreateFromContext_macosx at (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreateFromContext_macosx (intptr,int,int,intptr&) at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0x00000] in <filename unknown>:0 at System.Windows.Forms.XplatUICarbon.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0 at System.Windows.Forms.XplatUI.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0

Anyone got a clue ? Thank you!!

Answer1:

It's a known bug/regression in the 3.10 release: <a href="https://bugzilla.xamarin.com/show_bug.cgi?id=23553" rel="nofollow">https://bugzilla.xamarin.com/show_bug.cgi?id=23553</a>

This Xamarin forum thread provides a version with a fix: <a href="http://forums.xamarin.com/discussion/27011/fix-for-gdipcreatefromcontext-macosx-and-other-macios-gdi-issues" rel="nofollow">http://forums.xamarin.com/discussion/27011/fix-for-gdipcreatefromcontext-macosx-and-other-macios-gdi-issues</a>

Recommend

  • WndProc to detect device unplug and plug
  • Throw event in the main thread from worker thread C# CF
  • How to determine how long a song is using winmm.dll?
  • Get TitleBar Caption of any application using Microsoft UI Automation?
  • how to play a mp3 file from the middle
  • DllImport, Char*& and StringBuilder C/C#
  • SendMessage to a window Handle
  • Non-resizeable, bordered WPF Windows with WindowStyle=None
  • VB.NET How to send key 46 (Chr(46)) with SendMessage
  • C# Getting window's title by handle in Hebrew return question marks
  • CreateWindowEx fails with ERROR_CANNOT_FIND_WND_CLASS
  • show window while in full screen
  • Recreate Apple Watch fitness tracker ‘progress’ bar - gradient on CAShapeLayer stroke
  • Window screenshot using WinAPI
  • draw a B+ tree in latex
  • First time running a ASP site, and getting server error in '/' Application
  • UML diagram generator in Visual Studio 2010
  • How to create a custom Powershell operator?
  • Winforms: Add a close “x” button in a UserControl
  • Wrapping a c#/WPF GUI around c++/cli around native c++
  • Embedded Glassfish JPA Datasource connection fail
  • Need code translation from VB to C#
  • Android Activity.onWindowFocusChanged doesn't get called from within TabHost
  • Zoom in and out of jPanel
  • Graphics.CopyFromScreen [Web application] + The handle is invalid
  • Using a canvas object in a thread to do simple animations - Java
  • Debug.DrawLine not showing in the GameView
  • x64 applications using gdi+: what are the consequences on performance?
  • Custom Tabgroup Appcelerator
  • why do I get the error when installing the gem 'pg'? [duplicate]
  • MySQL WHERE-condition in procedure ignored
  • Knitr HTML Loop - Some HTML output, some R output
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Circular dependency while pushing http interceptor
  • Linker errors when using intrinsic function via function pointer
  • Benchmarking RAM performance - UWP and C#
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Sorting a 2D array using the second column C++
  • java string with new operator and a literal