Bug 11096 - 'Attempting to JIT compile method' error with async code using the 3.0 preview
Summary: 'Attempting to JIT compile method' error with async code using the 3.0 preview
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.3.x
Hardware: PC Mac OS
: Normal major
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2013-03-12 21:20 UTC by Miguel de Icaza [MSFT]
Modified: 2013-03-20 22:39 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Miguel de Icaza [MSFT] 2013-03-12 21:20:39 UTC
This is a regression with our recent MonoTouch based on 3.0 for JIT errors.

I have attached the sample that Jonathan sent us privately.

Screenshot of the error:
http://forums.xamarin.com/discussion/2184/attempting-to-jit-compile-method#latest

Log:

System.ExecutionEngineException: Attempting to JIT compile method 'HyperLocal.Demo.Xamios.MapViewController:m__B (object,MonoTouch.MapKit.MKMapViewChangeEventArgs)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

at MonoTouch.MapKit.MKMapView+_MKMapViewDelegate.RegionChanged (MonoTouch.MapKit.MKMapView mapView, Boolean animated) [0x00016] in /Developer/MonoTouch/Source/monotouch/src/MapKit/MKMapView.g.cs:1081 at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend_MKCoordinateRegion_bool (intptr,intptr,MonoTouch.MapKit.MKCoordinateRegion,bool) at MonoTouch.MapKit.MKMapView.SetRegion (MKCoordinateRegion region, Boolean animated) [0x00012] in /Developer/MonoTouch/Source/monotouch/src/MapKit/MKMapView.g.cs:206 at HyperLocal.Demo.Xamios.MapViewController.ResetManualMode () [0x00077] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/MapViewController.cs:143 at HyperLocal.Demo.Xamios.MapViewController+c__async0.MoveNext () [0x000fe] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/MapViewController.cs:96 at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[c__async0] (HyperLocal.Demo.Xamios.c__async0& stateMachine) [0x0001b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/AsyncVoidMethodBuilder.cs:106 at HyperLocal.Demo.Xamios.MapViewController.ViewDidLoad () [0x00000] in :0 at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr) at MonoTouch.UIKit.UIViewController.get_View () [0x00039] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:981 at HyperLocal.Demo.Xamios.PagedViewController.ReloadPages () [0x0006f] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/PagedViewController.cs:74 at HyperLocal.Demo.Xamios.PagedViewController.ViewDidAppear (Boolean animated) [0x0000b] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/PagedViewController.cs:138 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) [0x0004d] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 at HyperLocal.Demo.Xamios.Application.Main (System.String[] args) [0x00001] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/Main.cs:17
Comment 1 Zoltan Varga 2013-03-12 23:15:51 UTC
How can I reproduce this ?
Comment 2 Miguel de Icaza [MSFT] 2013-03-13 10:51:02 UTC
The file lives in files.xamarin.com:/home/miguel/HyperLocal-Xam-Async-Repro.zip
Comment 3 Miguel de Icaza [MSFT] 2013-03-13 10:51:21 UTC
(Sorry, I had not noticed that Bugzilla errored out on me with a "File too large to upload")
Comment 4 Zoltan Varga 2013-03-14 16:50:19 UTC
I can't reproduce this with mt 3.0 master, I get:

2013-03-14 21:48:52.190 HyperLocalDemoXamios[65511:907] Unhandled managed exception: Attempting to JIT compile method 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Srch2.Srch2Response`1<HyperLocal.Common.MarkerInfo>>:Start<Srch2.Srch2Client/<SearchGeoAsync>c__async0`1<HyperLocal.Common.MarkerInfo>> (Srch2.Srch2Client/<SearchGeoAsync>c__async0`1<HyperLocal.Common.MarkerInfo>&)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
 (System.ExecutionEngineException)
Comment 5 Zoltan Varga 2013-03-14 17:01:13 UTC
The particular method is not gsharedvt sharable because its type argument c__async0`1<HyperLocal.Common.MarkerInfo> is a valuetype with size 112.
Comment 6 Redth 2013-03-19 09:29:46 UTC
Is there any more info I can provide?  Or what is the workaround resolution?
Comment 7 Zoltan Varga 2013-03-19 10:08:11 UTC
There is no workaround/fix yet.
Comment 8 Miguel de Icaza [MSFT] 2013-03-19 16:29:57 UTC
Jon,

What we determined is that this code could not have worked with the old version of MonoTouch, so it is not a regression.

If you are observing a regression, then we are looking at two different problems.
Comment 9 Redth 2013-03-19 17:46:12 UTC
I'm not suggesting it's a regression... It's not working on the preview though :)
Comment 10 Zoltan Varga 2013-03-19 17:55:39 UTC
A workaround would be avoiding generic async methods, i.e. getting rid of the TRecord generic parameter from SearchGeoAsync<TRecord> for now.
Comment 11 Redth 2013-03-20 20:53:35 UTC
Ok, getting rid of the generic TRecord param fixes that instance, but now I'm getting a different JIT error when I build with linking on (Link SDK assemblies only).  This is happening on a call to the ctor of a bound class, so I'm not sure what to try (it's the ctor of a bound class at that).  I'm not sure if you want this as a new issue, or if it's related at all.

System.ExecutionEngineException: Attempting to JIT compile method 'Wikitude.Architect.ArchitectView:.ctor (System.Drawing.RectangleF)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at HyperLocal.Demo.Xamios.ArViewController.ViewWillAppear (Boolean animated) [0x00025] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/ArViewController.cs:56
  at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr (intptr,intptr,intptr)
  at MonoTouch.UIKit.UIView.AddSubview (MonoTouch.UIKit.UIView view) [0x00045] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIView.g.cs:386
  at HyperLocal.Demo.Xamios.PagedViewController.ReloadPages () [0x000ac] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/PagedViewController.cs:75
  at HyperLocal.Demo.Xamios.PagedViewController.ViewDidAppear (Boolean animated) [0x0000b] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/PagedViewController.cs:146
  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) [0x0004d] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at HyperLocal.Demo.Xamios.Application.Main (System.String[] args) [0x00001] in /Users/jonathan/Dropbox/Code/ArPresentation/HyperLocal.Demo.Xamios/Main.cs:17
Comment 12 Zoltan Varga 2013-03-20 20:59:46 UTC
I think this is a different problem. In the original testcase you sent, ArchitectView is an interface, so it has no .ctor.
Comment 13 Zoltan Varga 2013-03-20 22:39:48 UTC
The original async issue will be fixed in the next preview release. Please open a new report for this other issue.