Bug 12221 - Async methods crash with JIT compile exception
Summary: Async methods crash with JIT compile exception
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2013-05-13 12:06 UTC by Andrew Paulin
Modified: 2013-05-31 10:55 UTC (History)
3 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 Andrew Paulin 2013-05-13 12:06:58 UTC
Any attempt to use an async method in Xamarin.iOS beta throws a JIT exception. Code from my controller:

using System;
using System.Drawing;
using System.Net.Http;
using MonoTouch.Foundation;
using System.Collections.Generic;
using MonoTouch.UIKit;
using Archer.Base;
namespace Archer.Ios
  public class CategoryTableViewController : UITableViewController
		public CategoryTableViewController () : base (UITableViewStyle.Grouped)
		bool initialLoadComplete;
		public override void DidReceiveMemoryWarning ()
			// Releases the view if it doesn't have a superview.
			base.DidReceiveMemoryWarning ();
			// Release any cached data, images, etc that aren't in use.
		public override void ViewDidLoad ()
			base.ViewDidLoad ();
		public override void ViewDidAppear (bool animated)
			LoadCategories ();
			base.ViewDidAppear (animated);
		public async void LoadCategories ()
			foo = await (new HttpClient ()).GetStringAsync ("http://ifconfig.me/all.json");

and exception:

System.ExecutionEngineException: Attempting to JIT compile method 'System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<Archer.Ios.CategoryTableViewController/c__async0> (Archer.Ios.CategoryTableViewController/c__async0&)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

at Archer.Ios.CategoryTableViewController.LoadCategories () [0x00000] in :0 at Archer.Ios.CategoryTableViewController.ViewDidLoad () [0x0009d] in /Users/apaulin/src/Archer/Archer.Ios/CategoryTableViewController.cs:43 at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr) at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:129 at Archer.Ios.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00054] in /Users/apaulin/src/Archer/Archer.Ios/AppDelegate.cs:39 at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 at Archer.Ios.Application.Main (System.String[] args) [0x00001] in /Users/apaulin/src/Archer/Archer.Ios/Main.cs:17
Comment 1 Andrew Paulin 2013-05-14 14:28:10 UTC
Solved; this was caused by a troublesome generic method in the base library (despite only being included, not called)
Comment 2 Sebastien Pouliot 2013-05-31 10:55:01 UTC
Andrew, glad it works :) I made a test case based on the above but it did not fail for me.

Please re-open the bug if you can provide a more complete test case (that fail). If only to make sure we can analyze what went wrong and fix it. Thanks!