Bug 16156 - [bmac or mmp?] bmac with "-sdk:4" causes mmp error related to .NET 4.5 location of ExtensionAttribute
Summary: [bmac or mmp?] bmac with "-sdk:4" causes mmp error related to .NET 4.5 locati...
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: 1.6.19
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Chris Hamons
Depends on:
Reported: 2013-11-12 17:05 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-12-03 17:02 UTC (History)
2 users (show)

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

Test case (38.21 KB, application/zip)
2013-11-12 17:05 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 Brendan Zagaeski (Xamarin Team, assistant) 2013-11-12 17:05:42 UTC
Created attachment 5409 [details]
Test case

> Failed to resolve "System.Void System.Runtime.CompilerServices.ExtensionAttribute::.ctor()" reference from "mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
> mmp exited with code 1

## Steps to reproduce
1. Unzip attached test case.
2. Open the MutableAttributedTest project.
3. Attempt to run the project in Release mode so that `mmp` tries to link it with "Link All".

## Result

The ExtensionAttribute can't be resolved. It looks like the problem is that in TargetFrameworkVersion v4.0 this attribute is located in System.Core.dll rather than mscorlib.dll (see also bug #7888).

## Workarounds

1. Workaround at the `mmp` step: set the target framework to 4.5 [1] in the MutableAttributeTest.csproj project file.

> [1] <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

2. Workaround at the `bmac` step: recompile the `NSAttributedStringExtensions` assembly using bmac, but add `--compiler=dmcs` to the command line [2]. Copy the resulting `.dll` into the `MutableAttributedTest/lib` directory.

> [2] /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/usr/bin/bmac -oNSAttributedStringExtensions.dll --sdk=4 --compiler=dmcs --tmpdir=/tmp -baselib=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/usr/lib/mono/XamMac.dll --ns=MonoMac.AppKit -r:System.Drawing NSAttributedStringExtensions.cs
Comment 1 Chris Hamons 2014-12-03 17:02:10 UTC
Sorry for the delay in responding to this bug. 

This appears fixed in the latest Xamarin.Mac. Please reopen if you still have problems with a more recent version.