Bug 56683 - (Pre 3) - NRE in UnevenListViewDataSource.GetEstimatedRowHeight
Summary: (Pre 3) - NRE in UnevenListViewDataSource.GetEstimatedRowHeight
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.5
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-05-19 19:47 UTC by alan.spires
Modified: 2017-06-20 16:19 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 NOT_REPRODUCIBLE

Description alan.spires 2017-05-19 19:47:25 UTC
Please add a null check for....

https://github.com/xamarin/Xamarin.Forms/blob/20bfa5b5038ef3357f6048b1cb13105033650069/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs#L648

I've been getting frequent crashes.

Message:
Sequence contains no elements
Stack Trace:
System.Linq.Enumerable.First[TSource](System.Collections.Generic.IEnumerable`1[T] source)
Xamarin.Forms.Platform.iOS.ListViewRenderer+UnevenListViewDataSource.GetEstimatedRowHeight(UIKit.UITableView table)
Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateEstimatedRowHeight()
Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateItems(System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Int32 section, System.Boolean resetWhenGrouped)
Xamarin.Forms.Platform.iOS.ListViewRenderer.OnCollectionChanged(System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
Comment 1 Jimmy [MSFT] 2017-05-19 20:27:11 UTC
Thank you for reporting this! 

That's odd, if the collection is empty I'm wondering why it is not returning here[1] instead. Do you have a quick reproduction sample you can share? This way we can confirm where the crash is occurring and possibly create a UITest item to avoid in the future. Thanks!

[1] https://github.com/xamarin/Xamarin.Forms/blob/2.3.5/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs#L641
Comment 2 alan.spires 2017-05-19 20:34:42 UTC
Yes it is odd. I don't have a repo but I was able to consistently re-create it in a production app.

I prevented this error from continuing by wrapping a call in BeginInvokeOnMainThread (Forms) and awaiting that with a TaskCompletionSource. So I'm guessing it must have been a threading issue of some type.
Comment 3 Rui Marinho 2017-06-20 16:19:20 UTC
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Forms project adding just the code necessary to demonstrate the issue. 
 
Here are some reproduction best practices: https://gist.github.com/jassmith/92405c300e54a01dcc6d