Bug 21080 - QuickGraph dll Assemblies with Mono
Summary: QuickGraph dll Assemblies with Mono
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-03 05:15 UTC by Bhagya
Modified: 2014-09-11 08:19 UTC (History)
3 users (show)

Tags:
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 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 NOT_ON_ROADMAP

Description Bhagya 2014-07-03 05:15:30 UTC
Hello,

I am trying to use QuickGraph.dll and QuickGraph.Graphviz.dll assemblies in my F# program. Open source compiler Fsharpc compiles properly. But when I use Mono to run the exe file (I am using Ubuntu 12.04, Linux kernel version 3.8.0), I get a System.TypeLoadException as shown below.

Unhandled Exception: System.TypeLoadException: A type load exception has occurred.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: A type load exception has occurred.

By setting MONO_LOG_LEVEL to "debug", I understand that the problem is because Mono is not able to load System.Core.dll and System.dll referenced from within QuickGraph.dll and QuickGraph.Graphviz.dll respectively. There seems to be a Strongname (at the PublicKeyToken) mismatch between the System.Core.dll and System.dll assemblies referenced from within QuickGraph and the counterparts in Mono GAC (Global Assembly Cache). I can see that these assemblies are available in Mono GAC in my machine in folders /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089 and /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089. But as shown below in output from MONO_LOG_LEVEL="debug" mono xxx.exe command, I understand that Mono is looking for these dlls in /usr/lib/mono/gac/System.Core/4.0.0.0__7cec85d7bea7798e/ and /usr/lib/mono/gac/System/4.0.0.0__7cec85d7bea7798e/ .

Mono: gc took 20 usecs
Mono: Assembly Loader probing location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Image addref mscorlib[0x198eca0] -> /usr/lib/mono/4.0/mscorlib.dll[0x198df70]: 2
Mono: AOT failed to load AOT module /usr/lib/mono/4.0/mscorlib.dll.so: /usr/lib/mono/4.0/mscorlib.dll.so: cannot open shared object file: No such file or directory

Mono: Assembly Loader loaded assembly from location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Config attempting to parse: '/usr/lib/mono/4.0/mscorlib.dll.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/mscorlib/mscorlib.config'.
Mono: Assembly mscorlib[0x198eca0] added to domain Hello_World.exe, ref_count=1
.
.
.
.
.
.
Mono: Assembly Loader loaded assembly from location: '/home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/QuickGraph.dll'.
Mono: Config attempting to parse: '/home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/QuickGraph.dll.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/QuickGraph/QuickGraph.config'.
Mono: Assembly Ref addref Hello_World[0x1a0c3a0] -> QuickGraph[0x1a1c090]: 2
Mono: The request to load the assembly mscorlib v2.0.5.0 was remapped to v4.0.0.0
Mono: Assembly Ref addref QuickGraph[0x1a1c090] -> mscorlib[0x198eca0]: 4
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll'.
Mono: Image addref QuickGraph.Graphviz[0x1a32c30] -> /usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll[0x1a31bb0]: 2
Mono: Assembly QuickGraph.Graphviz[0x1a32c30] added to domain Hello_World.exe, ref_count=1
Mono: AOT failed to load AOT module /usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll.so: /usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll.so: cannot open shared object file: No such file or directory

Mono: Assembly Loader loaded assembly from location: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll'.
Mono: Config attempting to parse: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/QuickGraph.Graphviz/QuickGraph.Graphviz.config'.
Mono: Assembly Ref addref Hello_World[0x1a0c3a0] -> QuickGraph.Graphviz[0x1a32c30]: 2
Mono: The request to load the assembly mscorlib v2.0.5.0 was remapped to v4.0.0.0
Mono: Assembly Ref addref QuickGraph.Graphviz[0x1a32c30] -> mscorlib[0x198eca0]: 5
Mono: Assembly Ref addref QuickGraph.Graphviz[0x1a32c30] -> QuickGraph[0x1a1c090]: 3
Mono: The request to load the assembly System.Core v2.0.5.0 was remapped to v4.0.0.0
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System.Core/4.0.0.0__7cec85d7bea7798e/System.Core.dll'.
Mono: Assembly Loader probing location: '/home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/System.Core.dll'.
Mono: Assembly Loader probing location: '/usr/lib/System.Core.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System.Core/4.0.0.0__7cec85d7bea7798e/System.Core.exe'.
Mono: Assembly Loader probing location: '/home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/System.Core.exe'.
Mono: Assembly Loader probing location: '/usr/lib/System.Core.exe'.
Mono: The following assembly referenced from /home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/QuickGraph.dll could not be loaded:

 Assembly:   System.Core    (assemblyref_index=2)
 Version:    2.0.5.0
 Public Key: 7cec85d7bea7798e

The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/).

Mono: Failed to load assembly QuickGraph[0x1a1c090]

Mono: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies.
Missing method .ctor in assembly /home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/QuickGraph.dll, type System.Runtime.CompilerServices.ExtensionAttribute
Can't find custom attr constructor image: /home/bhagya/Documents/PHD/Implementations/Git/TTA/project-tta/WCET/TTA_Abacus/Fsharp_Examples/QuickGraph/QuickGraph.dll mtoken: 0x0a000080
Mono: The request to load the assembly System v2.0.5.0 was remapped to v4.0.0.0
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System/4.0.0.0__7cec85d7bea7798e/System.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/System.dll'.
Mono: Assembly Loader probing location: '/usr/lib/System.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System/4.0.0.0__7cec85d7bea7798e/System.exe'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/System.exe'.
Mono: Assembly Loader probing location: '/usr/lib/System.exe'.
Mono: The following assembly referenced from /usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/QuickGraph.Graphviz.dll could not be loaded:

 Assembly:   System    (assemblyref_index=2)
 Version:    2.0.5.0
 Public Key: 7cec85d7bea7798e

The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0__f3fb40175eec2af3/).

Mono: Failed to load assembly QuickGraph.Graphviz[0x1a32c30]

Mono: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies.

Unhandled Exception: System.TypeLoadException: A type load exception has occurred.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: A type load exception has occurred.

I have invested a lot of time in resolving this. On the brighter side, I understand things more clearly now.
Any help, suggestions on how to go about resolving this will be really helpful!!!

Thank you,
Anoop
Comment 1 Mikayla Hutchinson [MSFT] 2014-07-03 13:02:40 UTC
It looks like you're trying to use a dll that was built against Silverlight or Xamarin.iOS/Android. You need a version of the dll built for the full desktop/server framework.
Comment 2 Mikayla Hutchinson [MSFT] 2014-07-03 13:03:43 UTC
Actually, my mistake, it says "Retargetable=Yes" so it's a portable assembly.

You need a newer runtime, the 2.10 runtime did not support PCLs.
Comment 3 Rodrigo Kumpera 2014-07-21 18:08:55 UTC
Mono 2.10.x is not longer been maintained, please upgrade to 3.X and reopen this bug if you find that your bug still happens.
Comment 4 Bhagya 2014-09-11 08:19:39 UTC
I copied all relevant dll files to my working directory and did a fsharpc --standalone build. Problem solved. But the disadvantage is that executable size gets big obviously. But at the moment I dont really care.

-Anoop