Bug 765 - Regression: OrderBy() and GroupBy() throw ExecutionEngineException
Summary: Regression: OrderBy() and GroupBy() throw ExecutionEngineException
Status: RESOLVED DUPLICATE of bug 587
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 4.x
Hardware: PC Mac OS
: --- major
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-09-12 17:36 UTC by Startcom
Modified: 2011-09-12 21:36 UTC (History)
2 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 Startcom 2011-09-12 17:36:46 UTC
Just upgraded to MonoTouch 4.2, and now when running on the iPhone device, OrderBy and GroupBy extensions throw an exception. They were working fine in the previous version.

I have linker set to "Don't Link".

System.ExecutionEngineException: Attempting to JIT compile method 'System.Linq.Check:SourceAndKeySelector (object,object)' while running with --aot-only.

  at System.Linq.Enumerable.OrderBy[CalendarEvent,DateTime] (IEnumerable`1 source, System.Func`2 keySelector, IComparer`1 comparer) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2148 
  at System.Linq.Enumerable.OrderBy[CalendarEvent,DateTime] (IEnumerable`1 source, System.Func`2 keySelector) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2141 
  at Startcom.BizApps.DataStore.OnCalendarEventsLoaded (IEnumerable`1 calendarEvents, System.Exception exception) [0x00020] in /Users/macbookair/Dropbox/Projects/Apps/Startcom_BizApps/DataStore.cs:107 
  at Startcom.GoogleQueryUtilities+<ParseFeedAsync>c__AnonStorey0`1[Startcom.CalendarEvent].<>m__1 (System.Object s, System.ComponentModel.RunWorkerCompletedEventArgs e) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted (System.ComponentModel.RunWorkerCompletedEventArgs e) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.BackgroundWorker.<CompleteWorker>m__1 (System.Object darg) [0x00000] in <filename unknown>:0 
  at MonoTouch.UIKit.UIKitSynchronizationContext+<Post>c__AnonStoreyC.<>m__C () [0x00000] in <filename unknown>:0 
  at MonoTouch.Foundation.NSActionDispatcher.Apply () [0x00000] in <filename unknown>:0 
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0 
  at Startcom.BizApps.IssaquahCoffeeCompany.iOS.Application.Main (System.String[] args) [0x00000] in /Users/macbookair/Dropbox/Projects/Apps/Startcom_BizApps_IssaquahCoffeeCompany_IOS/Main.cs:14
Comment 1 Startcom 2011-09-12 17:38:28 UTC
Using Mono 2.10.5.
Comment 2 Sebastien Pouliot 2011-09-12 19:44:30 UTC
This looks very similar to bug #587. Can you

a) try using "Link SDK assemblies" to see if it works;

b) tell us which version of MonoTouch you were used before 4.2;

Comment 3 Startcom 2011-09-12 21:10:42 UTC
Linking SDK assemblies fixed it, and previously I was using MonoTouch 4.0.7. Thanks for the quick response
Comment 4 Sebastien Pouliot 2011-09-12 21:15:00 UTC
Thanks for confirming the issue. I'll raise the severity of the original bug report.

FWIW you should always use "Link SDK assemblies" for device builds. It makes smaller application and it makes the AOT compilation faster (faster enough so you'll likely build faster when linking).

*** This bug has been marked as a duplicate of bug 587 ***
Comment 5 Startcom 2011-09-12 21:26:33 UTC
Thanks - unfortunately, I had to use Don't Link because of another bug I filed: bug 716515. But I can survive with linking for now.
Comment 6 Sebastien Pouliot 2011-09-12 21:36:28 UTC
oh, sorry I did not recognize you ;-)

You should still use "Link SDK assemblies" but also add "--linkskip=Mono.Security" to the "extra mtouch arguments" (until a newer MonoTouch gets released with that fix). That should give you about 90% of the linker advantages (without both bugs).