FubarDevelopment / QuickGraph

Fork of https://quickgraph.codeplex.com/
Microsoft Public License
9 stars 2 forks source link

CP-25587: QuickGraph with Mono #147

Open fubar-coder opened 6 years ago

fubar-coder commented 6 years ago

From unknown CodePlex user on Thursday, 03 July 2014 02:01:42

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 10.04), 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.0b77a5c561934e089 and /usr/lib/mono/gac/System/4.0.0.0b77a5c561934e089. 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.07cec85d7bea7798e/ and /usr/lib/mono/gac/System/4.0.0.07cec85d7bea7798e/ .

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.0f3fb40175eec2af3/QuickGraph.Graphviz.dll'. Mono: Image addref QuickGraph.Graphviz[0x1a32c30] -> /usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0f3fb40175eec2af3/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.0f3fb40175eec2af3/QuickGraph.Graphviz.dll.so: /usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0f3fb40175eec2af3/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.0f3fb40175eec2af3/QuickGraph.Graphviz.dll'. Mono: Config attempting to parse: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0f3fb40175eec2af3/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.07cec85d7bea7798e/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.07cec85d7bea7798e/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.07cec85d7bea7798e/System.dll'. Mono: Assembly Loader probing location: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0f3fb40175eec2af3/System.dll'. Mono: Assembly Loader probing location: '/usr/lib/System.dll'. Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System/4.0.0.07cec85d7bea7798e/System.exe'. Mono: Assembly Loader probing location: '/usr/lib/mono/gac/QuickGraph.Graphviz/3.6.61114.0f3fb40175eec2af3/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.0f3fb40175eec2af3/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.0f3fb40175eec2af3/).

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

fubar-coder commented 6 years ago

Form unknown CodePlex user on Thursday, 11 September 2014 05:17:29

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