Bug 10448 - MonoMac apps do not run/debug with target runtime
Summary: MonoMac apps do not run/debug with target runtime
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Mac Add-in ()
Version: 4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2013-02-19 18:08 UTC by Mikayla Hutchinson [MSFT]
Modified: 2013-03-05 01:46 UTC (History)
3 users (show)

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

runtime (45.29 KB, image/png)
2013-02-21 16:20 UTC, kevinknoop
runtime 2 (60.78 KB, image/png)
2013-02-21 16:20 UTC, kevinknoop

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 Mikayla Hutchinson [MSFT] 2013-02-19 18:08:03 UTC
As reported at http://forums.xamarin.com/discussion/comment/4859/#Comment_4859

MonoMac apps do not run/debug with the current target runtime.

IIRC this is a regression, we used to use an env var to pass the runtime to the launch script.
Comment 1 kevinknoop 2013-02-20 13:05:50 UTC
MonoDevelop running on 2.10.9 with 3.0.3 installed works just fine. When MonoDevelop runs on 2.10.11 I get the error above.
Comment 2 Jeffrey Stedfast 2013-02-20 15:50:16 UTC
fixed in git
Comment 3 kevinknoop 2013-02-21 05:15:35 UTC
Thank you. Does this effect Xamarin.Mac too? This is an active project so I'm hoping to get up and running as soon as possible.
Comment 4 Jeffrey Stedfast 2013-02-21 14:12:18 UTC
Yea, it'll affect Xamarin.Mac, too.

Here's the latest internal build that you can use in the meantime:

Comment 5 kevinknoop 2013-02-21 16:06:12 UTC
Unfortunately I'm getting exactly the same thing with this build. I start debugging and get:

System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Mac'.
  at CentraStage.Mac.AppDelegate..ctor () [0x00000] in /Users/kevinknoop/Projects/centrastage/mobileapps/src/CentraStage/CentraStage.UI.Mac/AppDelegate.cs:21
  at at (wrapper dynamic-method) object.c0f2206b-1224-40a8-9ef7-5109ad9f3abb (intptr,MonoMac.ObjCRuntime.Selector) <IL 0x00028, 0x000ab>
  at at (wrapper native-to-managed) object.c0f2206b-1224-40a8-9ef7-5109ad9f3abb (intptr,MonoMac.ObjCRuntime.Selector) <IL 0x00036, 0x0011f>
  at at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00003>
  at at MonoMac.AppKit.NSApplication.Main (string[]) <IL 0x0000e, 0x0006b>
  at CentraStage.Mac.MainClass.Main (string[]) [0x00006] in /Users/kevinknoop/Projects/centrastage/mobileapps/src/CentraStage/CentraStage.UI.Mac/Main.cs:14
Comment 6 kevinknoop 2013-02-21 16:07:41 UTC
Here is the application output at startup:

Loaded assembly: /Users/kevinknoop/Projects/centrastage/mobileapps/src/CentraStage/CentraStage.UI.Mac/bin/Debug/CentraStage.Mac.app/Contents/MonoBundle/CentraStage.Mac.exe
Loaded assembly: /Users/kevinknoop/Projects/centrastage/mobileapps/src/CentraStage/CentraStage.UI.Mac/bin/Debug/CentraStage.Mac.app/Contents/MonoBundle/MonoMac.dll [External]
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/2.10.11/lib/mono/gac/System.Core/ [External]
Loaded assembly: ObjCImplementations [External]
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/2.10.11/lib/mono/gac/Mono.Security/ [External]
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/2.10.11/lib/mono/gac/System.Drawing/ [External]
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/2.10.11/lib/mono/gac/System/ [External]
Comment 7 Mikayla Hutchinson [MSFT] 2013-02-21 16:12:07 UTC
That's running with 2.10.11. Are you certain your target runtime is set to 3.0.x ?
Comment 8 kevinknoop 2013-02-21 16:20:04 UTC
Created attachment 3446 [details]
Comment 9 kevinknoop 2013-02-21 16:20:26 UTC
Created attachment 3447 [details]
runtime 2
Comment 10 kevinknoop 2013-02-21 16:21:06 UTC
I have attached 2 images.
Comment 11 kevinknoop 2013-02-21 16:37:43 UTC
If I create a new MonoMac or XamarinMac project and add the line below (target set to 3.0.3) I can reproduce the error straight away.

		public override void FinishedLaunching (NSObject notification)
			mainWindowController = new MainWindowController ();
			mainWindowController.Window.MakeKeyAndOrderFront (this);
Comment 12 Mikayla Hutchinson [MSFT] 2013-02-21 17:01:56 UTC
The default target runtime can be overridden for a solution - Check the Project -> Target Runtime menu.
Comment 13 Atin 2013-03-05 01:46:12 UTC
Today we have checked this issue with following environment:

X.S 4.0 - 2be9833ca58a68b3d64be96a40ab7e149647fed1
Mono 3.0.5 (master/5079328)
2.10.11 (mono-2-10/2baeee2)

And we are successfully able to run/debug monomac application.

Changing the status to Verified.