Bug 7114 - C#5 features not linking into AppStore build
Summary: C#5 features not linking into AppStore build
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: GIT
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-09-12 16:26 UTC by troy-dawson
Modified: 2012-10-31 19:38 UTC (History)
4 users (show)

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 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 troy-dawson 2012-09-12 16:26:27 UTC
With SDK 2.11.4 and MonoDevelop I can test C# 5 callerinfo attribute feature with the debug build

but when building for release I get build error:

Could not link assemblies: Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Runtime.CompilerServices.CallerFilePathAttribute::.ctor()
  at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x00000] in <filename unknown>:0 

Code added to Monomac AppDelegate.cs:

+		public static void C5Test([CallerFilePath] string filePath = null)
+		{
+			Console.WriteLine("Calller: {0}", filePath);
+		}

		public override void FinishedLaunching(NSObject notification)
			appWindow = new AppWindow(new RectangleF(0,0, 692,518+20));

+			AppDelegate.C5Test();

perhaps this is related the the oddity that Monodevelop project option > Build > General > Target Framework setting says ".Net 4.5" and not "Mono 4.5" (to match the "Mono/Net 4.0" choice)?

Similar error happens when I try to link async code:

Could not link assemblies: Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(System.Type)
Comment 1 Jeffrey Stedfast 2012-10-24 18:26:49 UTC

*** This bug has been marked as a duplicate of bug 7888 ***
Comment 2 Sebastien Pouliot 2012-10-30 11:18:07 UTC
It's a different issue from #7888.

It affects both the [AsyncStateMachine] and [IteratorStateMachine] attributes added in 4.5 and seems to be an encoding issue of the type.
Comment 3 Marek Safar 2012-10-30 12:02:10 UTC
Fixed the issue with AsyncStateMachineAttribute in mono master.
Comment 4 Sebastien Pouliot 2012-10-31 19:38:38 UTC
* The compiler fix both [AsyncStateMachine] and [IteratorStateMachine]; and
* [CallerFilePath] works as expected

Thanks for reporting both issues.