Bug 3114 - Linq statement that uses System.Linq.Enumerable.ThenByDescending can not be AOTed
Summary: Linq statement that uses System.Linq.Enumerable.ThenByDescending can not be ...
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-01-27 11:57 UTC by Jackson Harper
Modified: 2012-03-06 19:46 UTC (History)
4 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 Jackson Harper 2012-01-27 11:57:47 UTC
Linq statement that sorts a list of DateTimes ascending by date, descending by time:

from datetime in list orderby datetime.Date, datetime.TimeOfDay descending select datetime
Comment 1 Sebastien Pouliot 2012-03-01 15:09:29 UTC
You likely guessed that you ran into one of the generic limitations from http://docs.xamarin.com/ios/about/limitations#Limited_Generics_Support

In some cases it's possible to use ToString on the value-type used int the `orderly` clause. Sadly in this case the DateTime value-type is exposed in the generic signatures being created. Hiding this is not hard to it's not cute either. E.g.

		public void Workaround_3114 ()
			List<object> list = new List<object> () {
			var result = from datetime in list orderby ((DateTime) datetime).Date.ToString (), ((DateTime) datetime).TimeOfDay.ToString () descending select (DateTime) datetime;
			Assert.That (result.Count (), Is.EqualTo (2), "Count");

There are better options (for the original case) but I assume the above was a simpler test case extracted from something bigger. Anyway it's now part of the our test suite where we track those kind of limitations.
Comment 2 Rodrigo Kumpera 2012-03-06 19:46:05 UTC
This will be part of the next 5.3 alpha.