Bug 7888 - OS X packaging with .Net 4.5 fails with ResolutionException
Summary: OS X packaging with .Net 4.5 fails with ResolutionException
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-10-18 00:13 UTC by u.hertlein
Modified: 2012-11-07 20:28 UTC (History)
4 users (show)

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

OS X (MonoMac) solution/project; build 'Debug|x86 (17.37 KB, application/x-gzip)
2012-10-18 00:13 UTC, u.hertlein

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 Developer Community or GitHub 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:

Description u.hertlein 2012-10-18 00:13:15 UTC
Created attachment 2761 [details]
OS X (MonoMac) solution/project; build 'Debug|x86

Using the following:
Mono 2.11.4 (the only Mono runtime installed on the system)
OS X 10.8.2

Target framework .Net 4.5

Building a simple OS X project package with included Mono runtime and "Link all" or "Link frameworks" fails with a ResolutionException:

Merging Mono Runtime into app bundle
/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/mmp "-minos=10.6" -o "/Users/uli/Projects/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" -a "/Library/Frameworks/Mono.framework/Versions/2.11.4/lib/mono/gac/Mono.Cecil/" "/Users/uli/Projects/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/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
Comment 1 u.hertlein 2012-10-18 20:32:09 UTC
Works fine when targetting .Net 4.0 (with Mono-2.11.4 installed)
Comment 2 u.hertlein 2012-10-22 20:30:07 UTC
Also happens when using Mono-3.0 with the .NET 4.5 runtime.
Comment 3 Jeffrey Stedfast 2012-10-24 16:06:00 UTC
Sebastien: any ideas?
Comment 4 Sebastien Pouliot 2012-10-24 18:00:57 UTC
The System.Runtime.CompilerServices.ExtensionAttribute was moved to mscorlib.dll and that affects mmp's linker (as it does other tools [1]).

[1] https://connect.microsoft.com/VisualStudio/feedback/details/726702/moving-system-runtime-compilerservices-extensionattribute-to-mscorlib-breaks-structuremap-scans-of-namespaces-containing-extensionmethods-and-possibly-other-ioc-scenarios
Comment 5 Jeffrey Stedfast 2012-10-24 18:26:49 UTC
*** Bug 7114 has been marked as a duplicate of this bug. ***
Comment 6 Sebastien Pouliot 2012-10-26 10:26:09 UTC
The current `mmp` is a bit old (from 2.10 times) and it's defaulting for 4.0. The logic to get 4.5 (or future versions) depends on the assembly versions - which was not changed for .NET 4.5 (it's still 4.0). So we need a bit more logic to cover this case...
Comment 7 Sebastien Pouliot 2012-10-31 19:57:28 UTC
This, and a few other 4.5 specific, issues are now fixed. Thanks for reporting the issue.
Comment 8 u.hertlein 2012-11-07 20:28:58 UTC
Is this part of MonoDevelop or Mono?  I couldn't find a commit in either that looked like it might be related.