Bug 36004 - Linq Method Groups are broken
Summary: Linq Method Groups are broken
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 6.0.99
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-11-18 10:12 UTC by Caan Mee
Modified: 2017-06-28 11:52 UTC (History)
3 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 NORESPONSE

Description Caan Mee 2015-11-18 10:12:07 UTC
After upgrading to Xamarin 4 my app kept crashing, with the following exception:

I/MonoDroid( 8039): UNHANDLED EXCEPTION:
I/MonoDroid( 8039): System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
I/MonoDroid( 8039):   at (wrapper stelemref) System.Object:virt_stelemref_class (intptr,object)
I/MonoDroid( 8039):   at System.Linq.Lookup`2+Grouping[TKey,TElement].Add (TElement element) <0x98726e30 + 0x0005f> in <filename unknown>:0
I/MonoDroid( 8039):   at System.Linq.Lookup`2[TKey,TElement].Create[TSource] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) <0x987265f8 + 0x000cf> in <filename unknown>:0
I/MonoDroid( 8039):   at System.Linq.GroupedEnumerable`3[TSource,TKey,TElement].GetEnumerator () <0x98726570 + 0x0002f> in <filename unknown>:0
I/MonoDroid( 8039):   at System.Linq.Buffer`1[TElement]..ctor (IEnumerable`1 source) <0x9c60c740 + 0x000cc> in <filename unknown>:0
I/MonoDroid( 8039):   at System.Linq.OrderedEnumerable`1+<GetEnumerator>c__Iterator0[TElement].MoveNext () <0x9b3b8990 + 0x0007b> in <filename unknown>:0
I/MonoDroid( 8039):   at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () <0x9c407ee0 + 0x00135> in <filename unknown>:0

The line which caused the exception:

var models = dtos.Select(AutoMapper.Map<MyModel>).ToList();

when I convert the code to:
var models = dtos.Select(m => AutoMapper.Map<MyModel>(m)).ToList();

it seems to work flaweless.
Comment 1 Jonathan Pryor 2015-11-18 12:07:03 UTC
Please attach a test case so that we can more easily reproduce this.
Comment 2 Adam Hartley [MSFT] 2017-06-28 11:52:18 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!