[Mono-winforms-list] libgdiplus.dylib throws TypeInitializationException on Mac OS X (even with macpack)

Geoff Norton gnorton at novell.com
Wed Jan 2 14:17:14 EST 2008


You need X11 _installed_.  GDI+ still uses freetype2 and fontconfig  
for text rendering, which apple puts in the X11 package.

-g

On 2-Jan-08, at 12:14 PM, Chris Peterson wrote:

> I am trying to run a simple "Hello World" WinForms app on Mac OS X  
> using mono 1.2.6, but I get a TypeInitializationException from (or  
> regarding?) libgdiplus.dylib. I suspect libgdiplus.dylib might be  
> trying to using X11 (which I do not have installed), even though I  
> thought mono 1.2.6's WinForms no longer required X11 on Mac OS X.
>
> I tried using macpack ("macpack -m:1 -n:helloworld -o:. - 
> a:helloworld.exe"), but I still get the same  
> TypeInitializationException when running macpack's helloworld.app  
> (according to Mac OS X's Console utility).
>
> If I run "MONO_LOG_LEVEL=info MONO_LOG_MASK=dll mono  
> helloworld.exe", I get tons of DllImport errors/warnings about mono  
> searching for libgdiplus.dylib . When mono finds libgdiplus.dylib,  
> it then reports suspicious errors about X11:
>
> Mono-INFO: DllImport loading: '/Library/Frameworks/Mono.framework/ 
> Versions/1.2.6/lib
> /libgdiplus.dylib'.
> Mono-INFO: DllImport error loading library 'dlopen(/Library/ 
> Frameworks/Mono.framework/Versions/1.2.6/lib/libgdiplus.dylib, 9):  
> Library not loaded: /usr/X11R6/lib/libXrender.1.dylib
>   Referenced from: /Library/Frameworks/Mono.framework/Versions/1.2.6/ 
> lib/libgdiplus.dylib
>   Reason: image not found'.
>
> Any idea what I am doing wrong? Do I need still X11 to run WinForm  
> apps on Mac OS X? Or do I have a lib path problem with mono or  
> macpack? I've seen similar libgdiplus problems by Linux users on  
> this mailing list, but I don't know if they are related to my Mac OS  
> X woes.
>
>
> thanks!
> chris
>
>
> Unhandled Exception: System.TypeInitializationException: An  
> exception was thrown by the type initializer for  
> System.Windows.Forms.Form --->  
> System.Reflection.TargetInvocationException : Exception has been  
> thrown by the target of an invocation. --->  
> System.TypeInitializationException: An exception was thrown by the  
> type initializer for System.Drawing.GDIPlus --->  
> System.DllNotFoundException: /Library/Frameworks/Mono.framework/ 
> Versions/1.2.6/lib/libgdiplus.dylib
>   at (wrapper managed-to-native)  
> System.Drawing.GDIPlus:GdiplusStartup  
> (ulong 
> &,System 
> .Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
>   at System.Drawing.GDIPlus..cctor () [0x00000] --- End of inner  
> exception stack trace ---
>
>   at <0x00000> <unknown method>
>   at System.Drawing.Image.InitFromStream (System.IO.Stream stream)  
> [0x00000]
>   at System.Drawing.Image.InitFromStream (System.IO.Stream stream)  
> [0x00000]
>   at System.Drawing.Image..ctor  
> (System.Runtime.Serialization.SerializationInfo info,  
> StreamingContext context) [0x00000]
>   at System.Drawing.Bitmap..ctor  
> (System.Runtime.Serialization.SerializationInfo info,  
> StreamingContext context) [0x00000]
>   at <0x00000> <unknown method>
>   at (wrapper managed-to-native)  
> System.Reflection.MonoCMethod:InternalInvoke (object,object[])
>   at System.Reflection.MonoCMethod.Invoke (System.Object obj,  
> BindingFlags invokeAttr, System.Reflection.Binder binder,  
> System.Object[] parameters, System.Globalization.CultureInfo  
> culture) [0x00000] --- End of inner exception stack trace ---
>
>   at System.Reflection.MonoCMethod.Invoke (System.Object obj,  
> BindingFlags invokeAttr, System.Reflection.Binder binder,  
> System.Object[] parameters, System.Globalization.CultureInfo  
> culture) [0x00000]
>   at System.Reflection.MethodBase.Invoke (System.Object obj,  
> System.Object[] parameters) [0x00000]
>   at System.Runtime.Serialization.ObjectRecord.LoadData  
> (System.Runtime.Serialization.ObjectManager manager,  
> ISurrogateSelector selector, StreamingContext context) [0x00000]
>   at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00000]
>   at  
> System 
> .Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject  
> (System.IO.BinaryReader reader) [0x00000]
>   at  
> System 
> .Runtime 
> .Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph  
> (System.IO.BinaryReader reader, Boolean readHeaders, System.Object&  
> result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000]
>   at  
> System 
> .Runtime 
> .Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize  
> (System.IO.Stream serializationStream,  
> System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000]
>   at  
> System 
> .Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize  
> (System.IO.Stream serializationStream) [0x00000]
>   at System.Resources.ResourceReader.ReadNonPredefinedValue  
> (System.Type exp_type) [0x00000]
>   at System.Resources.ResourceReader.ReadValueVer1 (System.Type  
> type) [0x00000]
>   at System.Resources.ResourceReader.ResourceValue (Int32 index)  
> [0x00000]
>   at System.Resources.ResourceReader+ResourceEnumerator.get_Value ()  
> [0x00000]
>   at System.Resources.ResourceSet.ReadResources () [0x00000]
>   at System.Resources.ResourceSet.GetObject ( System.String name,  
> Boolean ignoreCase) [0x00000]
>   at System.Resources.ResourceManager.GetObject (System.String name,  
> System.Globalization.CultureInfo culture) [0x00000]
>   at System.Resources.ResourceManager.GetObject (System.String name)  
> [0x00000]
>   at System.Windows.Forms.Locale.GetResource (System.String name)  
> [0x00000]
>   at System.Windows.Forms.Form..cctor () [0x00000] --- End of inner  
> exception stack trace ---
>
>   at <0x00000> <unknown method>
>   at System.Windows.Forms.MessageBox+MessageBoxForm..ctor  
> (IWin32Window owner, System.String text, System.String caption,  
> MessageBoxButtons buttons, MessageBoxIcon icon, Boolean  
> displayHelpButton) [0x00000]
>   at System.Windows.Forms.MessageBox+MessageBoxForm..ctor  
> (IWin32Window owner, System.String text, System.String caption,  
> MessageBoxButtons buttons, MessageBoxIcon icon, Boolean  
> displayHelpButton) [0x00000]
>   at System.Windows.Forms.MessageBox+MessageBoxForm..ctor  
> (IWin32Window owner, System.String text, System.String caption,  
> MessageBoxButtons buttons, MessageBoxIcon icon) [0x00000]
>   at (wrapper remoting-invoke-with-check) MessageBoxForm:.ctor  
> (System 
> .Windows 
> .Forms 
> .IWin32Window 
> ,string 
> ,string 
> ,System 
> .Windows.Forms.MessageBoxButtons ,System.Windows.Forms.MessageBoxIcon)
>   at System.Windows.Forms.MessageBox.Show (System.String text)  
> [0x00000]
>   at HelloWorld.Main () [0x00000]
>
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20080102/1ba60f86/attachment.html 


More information about the Mono-winforms-list mailing list