Bug 5032 - XSP4 Error loading liblibgdiplus.dylib (System.DllNotFoundException)
Summary: XSP4 Error loading liblibgdiplus.dylib (System.DllNotFoundException)
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: libgdiplus ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-11 10:02 UTC by Wouter
Modified: 2017-11-23 16:39 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Solution to replicate the problem (5.16 KB, application/x-zip-compressed)
2012-05-11 10:02 UTC, Wouter
Details


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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Wouter 2012-05-11 10:02:31 UTC
Created attachment 1860 [details]
Solution to replicate the problem

If I run the attached project, XSP crashes with the following error:

System.DllNotFoundException
/Library/Frameworks/Mono.framework/Versions/2.11/liblibgdiplus.dylib

If I remove the 'ForeColor="Red"' property from the TextBox in Default.aspx, the page loads without any errors.

The problem also occurs when I start XSP manually from the Terminal. 
XSP tries to load the dylib from: /Library/Frameworks/Mono.framework/Versions/2.11/liblibgdiplus.dylib
But it is located at:
/Library/Frameworks/Mono.framework/Versions/2.11/lib/libgdiplus.dylib


Using:
OSX 10.7.4
MonoDevelop 2.9.5
Runtime:
	Mono 2.11.1 (master/426188e Thu Apr 19 19:14:12 EDT 2012)
	GTK 2.24.10
	GTK# (2.12.0.0)
Apple Developer Tools:
	 Xcode 4.3.2 (1177)
	 Build 4E2002
Comment 1 Frank Somers 2012-06-27 12:18:13 UTC
Here is a simpler test case for the same problem...

--- Versions:
$ uname -a
Darwin enki.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64

$ mono -V
Mono JIT compiler version 2.11.1 (master/426188e Thu Apr 19 19:14:12 EDT 2012)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          debugger softdebug 
	LLVM:          yes(3.1svn-mono)
	GC:            Included Boehm (with typed GC)


--- Create a very simple test program main.fs containing:
// Credit for original source snippet to:
// http://www.animal-machine.com/blog/2011/02/getting-started-with-f-2-0-mono-2-10-and-fedora/

open System
open System.Windows.Forms
open System.Drawing

type MainForm() as form =
    inherit Form()
    let label1 = new Label()
    do form.InitializeForm

    member this.InitializeForm =
        this.FormBorderStyle <- FormBorderStyle.Sizable
        this.Text <- "Hello World Application"
        this.Width <- 300
        this.Height <- 300
        label1.Text <- "Hello Internet!"
        this.Controls.AddRange([|(label1:> Control)|])

do Application.Run(new MainForm())

--- Compile and run:
$ fsharpc main.fs
$ mono main.exe
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.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeWin32Classic ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.KnownColors ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: /Library/Frameworks/Mono.framework/Versions/2.11/liblibgdiplus.dylib
...

Note the corrupted path to the library /Library/Frameworks/Mono.framework/Versions/2.11/liblibgdiplus.dylib, which should be /Library/Frameworks/Mono.framework/Versions/2.11/lib/libgdiplus.dylib

I tried including a trailing '/' in the DYLD path as follows:
$ export DYLD_LIBRARY_PATH="/Library/Frameworks/Mono.framework/Versions/2.11/lib/"
...to no avail.

As a 'hack', I tried:
$ sudo cp /Library/Frameworks/Mono.framework/Versions/2.11/lib/libgdiplus.0.dylib /Library/Frameworks/Mono.framework/Versions/2.11/liblibgdiplus.dylib

When I run with this hack in place, the app runs and the test window appears.

---
So, somewhere in  Mono, it is preparing a search path, and not automatically appending a trailing '/' to the search path...
Comment 2 Alexander Köplinger [MSFT] 2017-11-23 16:39:18 UTC
This seems to work now.