[Mono-osx] Mono.Cecil.ResolutionException when packaging for .Net 4.5

Ulrich Hertlein u.hertlein at gmail.com
Wed Oct 17 07:33:32 UTC 2012


Hi guys,

I'm trying to package a solution that's built against .Net 4.5 (Mono
2.11.4; Mono 2.10.9 is installed as well and is the current version)

When setting the packaging code generation options to include the Mono
runtime and the link behaviour to 'Link All' or 'Link Frameworks only'
I'm getting the following compiler error:

Merging Mono Runtime into app bundle
/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/mmp
"-minos=10.6" -o "/Users/uli/Projects/Research/Mac4dot5/bin/Debug" -n
"Mac4dot5" -a "/Library/Frameworks/Mono.framework/Versions/2.11.4/lib/mono/4.5/System.dll"
-a "/Library/Frameworks/Mono.framework/Versions/2.11.4/lib/mono/4.5/System.Core.dll"
-a "/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/MonoMac.dll"
"/Users/uli/Projects/Research/Mac4dot5/bin/Debug/Mac4dot5.exe"
Could not link assemblies: Mono.Cecil.ResolutionException: Failed to
resolve System.Void
System.Runtime.CompilerServices.ExtensionAttribute::.ctor()
  at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference
reference) [0x00000] in <filename unknown>:0
  at Mono.Linker.Steps.MarkStep.MarkCustomAttribute
(Mono.Cecil.CustomAttribute ca) [0x00000] in <filename unknown>:0
  at Mono.Linker.Steps.MarkStep.MarkCustomAttributes
(ICustomAttributeProvider provider) [0x00000] in <filename unknown>:0
  at Mono.Linker.Steps.MarkStep.MarkAssembly
(Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename
unknown>:0
  at Mono.Linker.Steps.MarkStep.InitializeAssembly
(Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename
unknown>:0
  at Mono.Linker.Steps.MarkStep.Initialize () [0x00000] in <filename unknown>:0
  at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext
context) [0x00000] in <filename unknown>:0
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context)
[0x00000]Failed to link
/Users/uli/Projects/Research/Mac4dot5/bin/Debug/Mac4dot5.exe
 in <filename unknown>:0
  at MonoMac.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline,
Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0
mmp exited with code 1

With 'Link Behaviour' set to 'Dont link' it compiles but throws at runtime:

Unhandled Exception: System.TypeLoadException: Could not load type
'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly
'mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
  at Mac4dot5.MainClass.Main (System.String[] args) [0x00000] in
<filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not
load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from
assembly 'mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
  at Mac4dot5.MainClass.Main (System.String[] args) [0x00000] in
<filename unknown>:0

Any ideas what could cause this?  I realize that 2.11 is beta, but
this appears to be more of a packaging issue than anything.
Maybe the installed 2.10 is sneaking in?  That last exception mentions
mscorlib version 4.0...

Cheers,
/uli


More information about the Mono-osx mailing list