Bug 55745 - [iOS] NRE in ListView with HasUnevenRows=true after changing content and rebinding
Summary: [iOS] NRE in ListView with HasUnevenRows=true after changing content and rebi...
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: 2.3.5
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-04-28 19:39 UTC by otyq08
Modified: 2017-06-29 12:00 UTC (History)
6 users (show)

See Also:
Tags: ios crash listview labelrenderer ac
Is this bug a regression?: Yes
Last known good build: Forms 2.3.4

Simple project for reproduction. (296.04 KB, application/x-zip-compressed)
2017-04-28 19:39 UTC, otyq08

Description otyq08 2017-04-28 19:39:48 UTC
Created attachment 21893 [details]
Simple project for reproduction.

NullReferenceException occurs after two simple operations in the ListView. First clear the list and add a item. Then clear and bind to a new ObservableCollection with previous content.

 	0x51 in UIKit.UIApplication.UIApplicationMain	C#
 	0xB in UIKit.UIApplication.Main at /Users/builder/data/lanes/4466/a04678c2/source/xamarin-macios/src/UIKit/UIApplication.cs:79,4	C#
 	0x3B in UIKit.UIApplication.Main at /Users/builder/data/lanes/4466/a04678c2/source/xamarin-macios/src/UIKit/UIApplication.cs:63,4	C#
>	0x8 in iOSNullRef.iOS.Application.Main at C:\Xamarin\iOSNullRef\iOSNullRef\iOSNullRef.iOS\Main.cs:17,4	C#

Does not happen with HasUnevenRows=false

Steps to Reproduce:
Press Toggle Button twice in attached simple example.

Actual Results: 
The application crashes.

Expected Results: 
The ListView should show the new content.

Build Date & Hardware: 
Occurs on Forms and pre1 with iOS Simulator iOS 10.3
Does not occur on Android or UWP. 
Does not occur on Forms 2.3.4
Comment 1 Jimmy [MSFT] 2017-04-28 22:18:38 UTC
I am able to reproduce this issue using the attached project and repro steps. I can confirm that this is a regression in 2.3.5.

As mentioned, the crash does _not_ occur if HasUnevenRows = false.

Complete stacktrace: https://gist.github.com/jimmgarrido/ff552aef31497910099e78746792c0db

### Regression test
2.3.5-pre2  BAD   GOOD   GOOD
Comment 2 Samantha Houts [MSFT] 2017-05-02 19:54:12 UTC
Comment 3 Samantha Houts [MSFT] 2017-05-10 18:05:14 UTC
Should be fixed in 2.3.5-pre3. Thank you!
Comment 4 Saurabh Paunikar 2017-06-29 12:00:38 UTC
Fixed verified on 
Xamarin.Forms version

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Xamarin (de55d19)
Xamarin.Android (f6289cd)
Xamarin.iOS (494fcbc)

Note You need to log in before you can comment on or make changes to this bug.