Bug 9095 - System.ExecutionEngineException: Attempting to JIT compile method
Summary: System.ExecutionEngineException: Attempting to JIT compile method
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.99.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-12-20 17:29 UTC by Marek Safar
Modified: 2013-03-20 13:13 UTC (History)
1 user (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 Marek Safar 2012-12-20 17:29:06 UTC
using System;
using System.Linq;
using System.Collections;

public class Bugged
  public static void Test<T> (T[] values)
    var all = from v in values select v;
    var res = all.ToArray ();

  public static void Main ()
    Test (new[] { DayOfWeek.Friday, DayOfWeek.Saturday });

Use program above from MT and you get 

System.ExecutionEngineException: Attempting to JIT compile method 'TestMt9.Bugged:<Test`1>m__0<System.DayOfWeek> (System.DayOfWeek)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator1D`2[System.DayOfWeek,System.DayOfWeek].MoveNext () [0x00059] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2269
  at System.Collections.Generic.List`1[System.DayOfWeek].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections.Generic/List.cs:127
  at System.Collections.Generic.List`1[System.DayOfWeek]..ctor (IEnumerable`1 collection) [0x0002f] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections.Generic/List.cs:64
  at System.Linq.Enumerable.ToArray[DayOfWeek] (IEnumerable`1 source) [0x00029] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2885
  at TestMt9.Bugged.Test[DayOfWeek] (System.DayOfWeek[] values) [0x00013] in /Users/marek/Projects/TestMt9/TestMt9/AppDelegate.cs:20
  at TestMt9.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x0003c] in /Users/marek/Projects/TestMt9/TestMt9/AppDelegate.cs:65
  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 TestMt9.Application.Main (System.String[] args) [0x00000] in /Users/marek/Projects/TestMt9/TestMt9/Main.cs:17
Comment 1 Marek Safar 2013-03-20 13:13:58 UTC
This now works with 3.0 based MT