locked
FontFamilyNotFound exception from bundled Xamarin.Mac app on OS X 10.7 RRS feed

  • Question

  • User10353 posted

    I'm new to Mono and Xamarin.Mac and am trying to get a Windows Forms app working as a bundled Mono application (so our end users don't have to install Mono). We're using Xamarin.Mac 4.0.4 build 2 with the latest mmp patch to get round the gdiplus problems.

    We're now encountering a font issue. I enclose the bottom of the debug output and would be grateful if someone could help explain how we can figure out which font is missing and how we can bundle it so our end users don't have to manually find and install it.

    Thanks,

    Andrew


    Mono: Searching for 'GdipGetGenericFontFamilySerif'. Mono: Probing 'GdipGetGenericFontFamilySerif'. Mono: Found as 'GdipGetGenericFontFamilySerif'. Mono: DllImport attempting to load: 'gdiplus.dll'. Mono: DllImport loading library: '/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll'. Mono: DllImport error loading library 'dlopen(/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll, 9): image not found'. Mono: DllImport loading library: '/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll.dylib'. Mono: DllImport error loading library 'dlopen(/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll.dylib, 9): image not found'. Mono: DllImport loading library: '/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll.so'. Mono: DllImport error loading library 'dlopen(/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll.so, 9): image not found'. Mono: DllImport loading library: '/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll.bundle'. Mono: DllImport error loading library 'dlopen(/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dll.bundle, 9): image not found'. Mono: DllImport loading location: 'libgdiplus.dll'. Mono: DllImport error loading library: 'dlopen(libgdiplus.dll, 9): image not found'. Mono: DllImport loading location: 'libgdiplus.dll.dylib'. Mono: DllImport error loading library: 'dlopen(libgdiplus.dll.dylib, 9): image not found'. Mono: DllImport loading location: 'libgdiplus.dll.so'. Mono: DllImport error loading library: 'dlopen(libgdiplus.dll.so, 9): image not found'. Mono: DllImport loading location: 'libgdiplus.dll.bundle'. Mono: DllImport error loading library: 'dlopen(libgdiplus.dll.bundle, 9): image not found'. Mono: DllImport loading: 'gdiplus.dll'. Mono: DllImport error loading library 'dlopen(gdiplus.dll, 9): image not found'. Mono: DllImport loading library: '/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus'. Mono: DllImport error loading library 'dlopen(/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus, 9): image not found'. Mono: DllImport loading library: '/Applications/iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.dylib'. Mono: Searching for 'GdipGetGenericFontFamilyMonospace'. Mono: Probing 'GdipGetGenericFontFamilyMonospace'. Mono: Found as 'GdipGetGenericFontFamilyMonospace'.

    Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound] at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in :0 at System.Drawing.FontFamily..ctor (GenericFontFamilies genericFamily) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies) at System.Drawing.FontFamily.getGenericSansSerif () [0x00000] in :0 at System.Drawing.Font.CreateFont (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) [0x00000] in :0 at System.Drawing.Font..ctor (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) [0x00000] in :0 at System.Drawing.Font..ctor (System.String familyName, Single emSize, System.String systemName) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string) at System.Drawing.SystemFonts.getDefaultFont () [0x00000] in :0 at System.Windows.Forms.Theme..ctor () [0x00000] in :0 at System.Windows.Forms.ThemeWin32Classic..ctor () [0x00000] in :0 at System.Windows.Forms.ThemeVisualStyles..ctor () [0x00000] in :0 at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in :0 --- End of inner exception stack trace --- at System.Windows.Forms.SystemInformation.getMenuAccessKeysUnderlined () [0x00000] in :0 at System.Windows.Forms.Control..ctor () [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor () at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in :0 --- End of inner exception stack trace --- at System.Windows.Forms.Control..ctor () [0x00000] in :0 at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in :0 at System.Windows.Forms.ContainerControl..ctor () [0x00000] in :0 at System.Windows.Forms.Form..ctor () [0x00000] in :0 at Reincubate.iPhoneBE.Forms.FormMain..ctor () [0x00000] in :0 at (wrapper remoting-invoke-with-check) Reincubate.iPhoneBE.Forms.FormMain:.ctor () at Reincubate.iPhoneBE.Program.Main (System.String[] argv) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound] at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in :0 at System.Drawing.FontFamily..ctor (GenericFontFamilies genericFamily) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies) at System.Drawing.FontFamily.getGenericSansSerif () [0x00000] in :0 at System.Drawing.Font.CreateFont (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) [0x00000] in :0 at System.Drawing.Font..ctor (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) [0x00000] in :0 at System.Drawing.Font..ctor (System.String familyName, Single emSize, System.String systemName) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string) at System.Drawing.SystemFonts.getDefaultFont () [0x00000] in :0 at System.Windows.Forms.Theme..ctor () [0x00000] in :0 at System.Windows.Forms.ThemeWin32Classic..ctor () [0x00000] in :0 at System.Windows.Forms.ThemeVisualStyles..ctor () [0x00000] in :0 at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in :0 --- End of inner exception stack trace --- at System.Windows.Forms.SystemInformation.getMenuAccessKeysUnderlined () [0x00000] in :0 at System.Windows.Forms.Control..ctor () [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor () at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in :0 --- End of inner exception stack trace --- at System.Windows.Forms.Control..ctor () [0x00000] in :0 at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in :0 at System.Windows.Forms.ContainerControl..ctor () [0x00000] in :0 at System.Windows.Forms.Form..ctor () [0x00000] in :0 at Reincubate.iPhoneBE.Forms.FormMain..ctor () [0x00000] in :0 at (wrapper remoting-invoke-with-check) Reincubate.iPhoneBE.Forms.FormMain:.ctor () at Reincubate.iPhoneBE.Program.Main (System.String[] argv) [0x00000] in :0

    Wednesday, May 15, 2013 11:06 AM

All replies

  • User2589 posted

    I assume the application works when not bundled, right ?

    If so build your application then, from a terminal window, run the commands

    a. dyldinfo -dylibs YourApp.app/Contents/MonoBundle/libgdiplus.0.dylib

    b. ls -l YourApp.app/Contents/MonoBundle/

    where YourApp.app points to the output directory where the .app was generated/executed.

    Wednesday, May 15, 2013 12:16 PM
  • User10353 posted

    The app works when not bundled (on our build Mac which is running OS X 10.8). Here's the output of the two commands:

    of-pc-3:Debug adancy$ dyldinfo -dylibs  iPhoneBackupExtractor.app/Contents/MonoBundle/libgdiplus.0.dylib 
    attributes     dependent dylibs
                @executable_path/../MonoBundle/libglib-2.0.0.dylib
                @executable_path/../MonoBundle/libintl.8.dylib
                @executable_path/../MonoBundle/libcairo.2.dylib
                @executable_path/../MonoBundle/libpixman-1.0.dylib
                /usr/lib/libSystem.B.dylib
                @executable_path/../MonoBundle/libtiff.3.dylib
                @executable_path/../MonoBundle/libjpeg.8.dylib
                @executable_path/../MonoBundle/libgif.4.dylib
                @executable_path/../MonoBundle/libpng14.14.dylib
                @executable_path/../MonoBundle/libfontconfig.1.dylib
                /usr/lib/libiconv.2.dylib
                @executable_path/../MonoBundle/libfreetype.6.dylib
                /usr/lib/libz.1.dylib
                /usr/lib/libbz2.1.0.dylib
                @executable_path/../MonoBundle/libexpat.1.dylib
                /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices"
    
    of-pc-3:Debug adancy$ ls -l iPhoneBackupExtractor.app/Contents/MonoBundle/
    total 55480
    -rw-r--r--  1 adancy  staff    10240 15 May 11:16 Accessibility.dll
    -rw-r--r--  1 adancy  staff   168448 15 May 11:16 Mono.Data.Sqlite.dll
    -rw-r--r--  1 adancy  staff   100352 15 May 11:16 Mono.Data.Tds.dll
    -rw-r--r--  1 adancy  staff   185856 15 May 11:16 Mono.Posix.dll
    -rw-r--r--  1 adancy  staff   296960 15 May 11:16 Mono.Security.dll
    -rw-r--r--  1 adancy  staff    19456 15 May 11:16 Mono.Web.dll
    -rw-r--r--  1 adancy  staff   169984 15 May 11:16 Mono.WebBrowser.dll
    -rw-r--r--  1 adancy  staff    22528 15 May 11:16 System.Configuration.Install.dll
    -rw-r--r--  1 adancy  staff   122880 15 May 11:16 System.Configuration.dll
    -rw-r--r--  1 adancy  staff   291840 15 May 11:16 System.Core.dll
    -rw-r--r--  1 adancy  staff   849920 15 May 11:16 System.Data.dll
    -rw-r--r--  1 adancy  staff   443392 15 May 11:16 System.Drawing.dll
    -rw-r--r--  1 adancy  staff    45568 15 May 11:16 System.EnterpriseServices.dll
    -rw-r--r--  1 adancy  staff    48128 15 May 11:16 System.Management.dll
    -rw-r--r--  1 adancy  staff   132096 15 May 11:16 System.Security.dll
    -rw-r--r--  1 adancy  staff    30208 15 May 11:16 System.Transactions.dll
    -rw-r--r--  1 adancy  staff   348672 15 May 11:16 System.Web.Services.dll
    -rw-r--r--  1 adancy  staff  2267136 15 May 11:16 System.Web.dll
    -rw-r--r--  1 adancy  staff  3023360 15 May 11:16 System.Windows.Forms.dll
    -rw-r--r--  1 adancy  staff  1269760 15 May 11:16 System.Xml.dll
    -rw-r--r--  1 adancy  staff  1710080 15 May 11:16 System.dll
    -rw-r--r--  1 adancy  staff     1749 15 May 11:16 config
    -rwxr-xr-x  1 adancy  staff   982016 15 May 11:16 iPhoneBackupExtractor.exe
    -rw-r--r--  1 adancy  staff    94807 15 May 11:16 iPhoneBackupExtractor.exe.mdb
    -rwxr-xr-x  1 adancy  staff   318728 15 May 11:16 libMonoPosixHelper.dylib
    -rwxr-xr-x  1 adancy  staff   993720 15 May 11:16 libcairo.2.dylib
    -rwxr-xr-x  1 adancy  staff   199572 15 May 11:16 libexpat.1.5.2.dylib
    lrwxr-xr-x  1 adancy  staff       20 15 May 11:16 libexpat.1.dylib -> libexpat.1.5.2.dylib
    -rwxr-xr-x  1 adancy  staff    56872 15 May 11:16 libffi.6.dylib
    -rwxr-xr-x  1 adancy  staff   257740 15 May 11:16 libfontconfig.1.dylib
    -rwxr-xr-x  1 adancy  staff   718752 15 May 11:16 libfreetype.6.dylib
    -rwxr-xr-x  1 adancy  staff   552120 15 May 11:16 libgdiplus.0.dylib
    lrwxr-xr-x  1 adancy  staff       18 15 May 11:16 libgdiplus.dylib ->   libgdiplus.0.dylib
    -rwxr-xr-x  1 adancy  staff   154504 15 May 11:16 libgdk_pixbuf-    2.0.0.dylib
    lrwxr-xr-x  1 adancy  staff       25 15 May 11:16 libgdk_pixbuf-2.0.dylib   -> libgdk_pixbuf-2.0.0.dylib
    -rwxr-xr-x  1 adancy  staff    43128 15 May 11:16 libgif.4.1.6.dylib
    lrwxr-xr-x  1 adancy  staff       18 15 May 11:16 libgif.4.dylib ->     libgif.4.1.6.dylib
    -rwxr-xr-x  1 adancy  staff  1661464 15 May 11:16 libgio-2.0.0.dylib
    -rwxr-xr-x  1 adancy  staff  1450260 15 May 11:16 libglib-2.0.0.dylib
    -rwxr-xr-x  1 adancy  staff    15468 15 May 11:16 libgmodule-2.0.0.dylib
    -rwxr-xr-x  1 adancy  staff   364696 15 May 11:16 libgobject-2.0.0.dylib
    lrwxr-xr-x  1 adancy  staff       22 15 May 11:16 libgobject-2.0.dylib -> libgobject-2.0.0.dylib
    -rwxr-xr-x  1 adancy  staff    21272 15 May 11:16 libgthread-2.0.0.dylib
    -rw-r--r--  1 adancy  staff    71808 15 May 11:16 libintl.8.dylib
    lrwxr-xr-x  1 adancy  staff       15 15 May 11:16 libintl.dylib -> libintl.8.dylib
    -rwxr-xr-x  1 adancy  staff   285972 15 May 11:16 libjpeg.8.dylib
    -rwxr-xr-x  1 adancy  staff  2951248 15 May 11:16 libpixman-1.0.dylib
    -rwxr-xr-x  1 adancy  staff   208320 15 May 11:16 libpng14.14.dylib
    -rwxr-xr-x  1 adancy  staff   897636 15 May 11:16 libsqlite3.0.8.6.dylib
    lrwxr-xr-x  1 adancy  staff       22 15 May 11:16 libsqlite3.0.dylib -> libsqlite3.0.8.6.dylib
    lrwxr-xr-x  1 adancy  staff       22 15 May 11:16 libsqlite3.dylib -> libsqlite3.0.8.6.dylib
    -rwxr-xr-x  1 adancy  staff   481492 15 May 11:16 libtiff.3.dylib
    -rw-r--r--  1 adancy  staff    28781 15 May 11:16 machine.config
    -rwxr-xr-x  1 adancy  staff  2596352 15 May 11:16 mscorlib.dll
    -rwxr-xr-x  1 adancy  staff  1314326 15 May 11:16 mscorlib.dll.mdb
    
    Wednesday, May 15, 2013 2:25 PM