Bug 59896 - v2.4.0: Adding inserting section to ListView causes crash IF first section is empty
Summary: v2.4.0: Adding inserting section to ListView causes crash IF first section is...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: 2.4.0
Hardware: Macintosh Mac OS
: High major
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
URL:
: 60177 60289 60388 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-02 14:58 UTC by Ben Askren
Modified: 2017-12-18 19:08 UTC (History)
23 users (show)

See Also:
Tags: listview, section, ac, fr
Is this bug a regression?: Yes
Last known good build:


Attachments
Bug reproduce sample (18.00 KB, application/x-zip-compressed)
2017-11-14 16:08 UTC, stanislav.svist
Details

Description Ben Askren 2017-10-02 14:58:42 UTC
== Issue Description
As of Xamain.Forms version 2.4.0, inserting a new section to a ListView in an iOS app causes the app to crash.  This does not happen in earlier versions of Xamarin.Forms.

== Demo project:
https://github.com/baskren/ListViewUpdate

== Steps to replicate
1. Download, build, and run demo project
2. Click the "Add Group between A & C" button.  An exception is thrown at line 508 in Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.UpdateItems.
3. In the ListViewUpdate.iOS project, change the package version of Xamarin.Forms to any 2.3.4 version.
4. Clean, build, and run the demo project.
5. Success!

== Arch chair analysis
In version 2.4.0, Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.UpdateItems was changed to check if the e.NewStartingIndex and e.OldStartingIndex was greater than the native UITableView's number of rows in the section.

		void UpdateItems(NotifyCollectionChangedEventArgs e, int section, bool resetWhenGrouped)
		{
			var exArgs = e as NotifyCollectionChangedEventArgsEx;
			if (exArgs != null)
				_dataSource.Counts[section] = exArgs.Count;

			var groupReset = resetWhenGrouped && Element.IsGroupingEnabled;

			var lastIndex = Control.NumberOfRowsInSection(section);
			if (e.NewStartingIndex > lastIndex || e.OldStartingIndex > lastIndex)
				throw new ArgumentException(
					$"Index '{Math.Max(e.NewStartingIndex, e.OldStartingIndex)}' is greater than the number of rows '{lastIndex}'.");

That being said, in the demo project (all 2.3.4 and 2.4.0 versions of XF), the UpdateItems call is made using section parameter = 0 even though section 0 is not the section with updated items (it is the root of the collection that had the change, not section 0).  Why this is happening?  If it helps get this fixed faster, I'll be happy to look into this.

== System Enviroment
=== Visual Studio Community 2017 for Mac ===

Version 7.1.5 (build 2)
Installation UUID: c3c61da2-4d87-4c39-b8d3-9fbf7e6af430
Runtime:
	Mono 5.2.0.224 (d15-3/14f2c81) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000224

=== NuGet ===

Version: 4.3.0.2418

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	1.1.1
	1.0.4
SDK: /usr/local/share/dotnet/sdk/1.0.3/Sdks
SDK Version: 1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 9.0 (13247)
Build 9A235

=== Xamarin.Mac ===

Version: 3.6.3.3 (Visual Studio Community)

=== Xamarin.Android ===

Version: 7.4.5.1 (Visual Studio Community)
Android SDK: /Users/ben/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 25.0.6
SDK Build Tools Version: 25.0.3

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.iOS ===

Version: 11.0.0.0 (Visual Studio Community)
Hash: 152b654a
Branch: xcode9
Build date: 2017-09-15 02:25:56-0400

=== Xamarin Inspector ===

Version: 1.3.1
Hash: cbc48dd
Branch: 1.3-release
Build date: Thu, 21 Sep 2017 19:52:53 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 701050002
Git revision: 7afedcaef8e7542e70e3cf8f9bdb26938b8c0876
Build date: 2017-09-15 08:39:58-04
Xamarin addins: 3262aadf811a18c12eac6742532d052b0139a808
Build lane: monodevelop-lion-d15-3-xcode9

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 1 Paul DiPietro [MSFT] 2017-10-02 16:36:03 UTC
Reproduction project was acting up but putting the code into a fresh project reproduces the behavior.
Comment 2 Paul DiPietro [MSFT] 2017-10-13 13:48:24 UTC
*** Bug 60177 has been marked as a duplicate of this bug. ***
Comment 3 Paul DiPietro [MSFT] 2017-10-20 15:14:32 UTC
*** Bug 60289 has been marked as a duplicate of this bug. ***
Comment 4 Luca Pappagallo 2017-10-25 17:38:50 UTC
I'm experiencing same issue with Xamarin.Forms 2.4.0.18342. I partially solved (sometimes works, sometimes doesn't) not using ObservableCollection where i could and avoiding "Clear()" function on ObservableCollections, using instead something like:

while(myCollection.Count > 0) 
   myCollection.RemoveAt(0);

Hope this helps someone, and hope this will be soon fixed because this is a big error!

Regards
Comment 5 Paul DiPietro [MSFT] 2017-10-26 13:03:52 UTC
*** Bug 60388 has been marked as a duplicate of this bug. ***
Comment 6 Dale Cebula 2017-10-31 16:10:30 UTC
Are we actually going to see this issue resolved?
Comment 7 Samantha Houts [MSFT] 2017-10-31 19:04:24 UTC
https://github.com/xamarin/Xamarin.Forms/pull/1244
Comment 8 Rui Marinho 2017-11-08 12:35:24 UTC
Should be fixed on 2.4.0-sr5
Comment 9 Dale Cebula 2017-11-08 12:45:57 UTC
Nice one, what's the ETA on 2.4.0-sr5?
Comment 10 Luca Pappagallo 2017-11-08 13:20:16 UTC
2.4.0-sr5 ? sr3 is the latest that I can see in the website (https://developer.xamarin.com/releases/xamarin-forms/xamarin-forms-2.4/2.4.0-sr3/) 

What am I missing? I'm really interested in this bugfix!

Thanks
Comment 11 Dan Beaton 2017-11-10 00:42:58 UTC
Do we know what release this was introduced in? A recommended rollback version? We uncovered it a bit late.

ETA on 2.4.0-sr5 would be great. :)
Comment 12 Thomas 2017-11-10 12:10:38 UTC
We experience thousands of crashes per day due this bug. A fast delivery would be very much appreciated.
Comment 13 Happypig375 2017-11-11 00:47:46 UTC
2.4.0-sr5 now on GitHub: https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.4.0-sr5
Comment 14 Samantha Houts [MSFT] 2017-11-11 00:48:55 UTC
And nuget ;)

https://www.nuget.org/packages/Xamarin.Forms/2.4.0.74863
Comment 15 stanislav.svist 2017-11-11 21:02:10 UTC
I have just checked 2.4.0.74863 from Nuget and it's NOT fixed.
Now we have a new place where something is wrong.

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
  at Xamarin.Forms.ListProxy.get_Item (System.Int32 index) [0x0000b] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:127
  at Xamarin.Forms.ListProxy.System.Collections.IList.get_Item (System.Int32 index) [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:441
  at Xamarin.Forms.Platform.iOS.ListViewRenderer+UnevenListViewDataSource.GetEstimatedRowHeight (UIKit.UITableView table) [0x00055] in <eb211aa32ac8429489411f4d642db9c2>:0
  at Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateEstimatedRowHeight () [0x0006c] in <eb211aa32ac8429489411f4d642db9c2>:0
  at Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateItems (System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Int32 section, System.Boolean resetWhenGrouped) [0x000bc] in <eb211aa32ac8429489411f4d642db9c2>:0
  at Xamarin.Forms.Platform.iOS.ListViewRenderer.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <eb211aa32ac8429489411f4d642db9c2>:0
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000a] in D:\agent\_work\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:771
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnCollectionChangedGrouped (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x000d5] in D:\agent\_work\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:798
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnProxyCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Boolean fixWindows) [0x00008] in D:\agent\_work\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:975
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnProxyCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:968
  at Xamarin.Forms.ListProxy.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000a] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:233
  at Xamarin.Forms.ListProxy+<>c__DisplayClass33_0.<OnCollectionChanged>b__0 () [0x00018] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:206
  at Xamarin.Forms.ListProxy.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x000a0] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:225
  at Xamarin.Forms.ListProxy+WeakNotifyProxy.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00031] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:394
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:351
  at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:219
  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:67
  at MyApp.NewModel+<GetItems>d__12.MoveNext () [0x003d3] in /Users/admin/Projects/MyApp 2/MyApp/MyAppForms/ViewModels/NewModel.cs:141
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
  at MyApp.NewPage+<Load>d__3.MoveNext () [0x0005b] in /Users/admin/Projects/MyApp 2/MyApp/MyAppForms/Pages/NewPage.xaml.cs:43
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
  at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/Foundation/NSAction.cs:163
  at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:63
Comment 16 stanislav.svist 2017-11-11 21:03:23 UTC
Rolling back to 2.3.4.270... again... :(
Comment 17 Paul DiPietro [MSFT] 2017-11-11 21:28:48 UTC
Can you please give us a new reproduction scenario?
Comment 18 Michael Dimoudis 2017-11-12 23:02:54 UTC
I just want to say a big thank you for fixing this bug so quickly, it was a show stopper for our app update, and the fix came at a perfect time :)
Comment 19 Eduard Lorente 2017-11-13 08:20:38 UTC
In my case I have a "Null reference exception". Only in iOS.

I'll try to provide you an example, but this is the exception stack. 



Uncaught exception: System.NullReferenceException: Object reference not set to an instance of an objectXamarin Exception Stack:
  at Xamarin.Forms.Platform.iOS.EventTracker.LoadRecognizers () [0x0005d] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\EventTracker.cs:347 
  at Xamarin.Forms.Platform.iOS.EventTracker.OnElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs e) [0x0004e] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\EventTracker.cs:413 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0002c] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00118] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Fo
rms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0008c] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:152 
  at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:151 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Visual
ElementPackager.cs:134 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0002c] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00118] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0008c] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:152 
  at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Form
s.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:151 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:134 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0002c] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.FrameRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Renderers\FrameRenderer.cs:11 
  at Habitatsoft.iOS.Renderers.HSFrameRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x00001] in C:\GIT\HabitatSoft\Apps\Habitatsoft\Habitatsoft.
iOS\Renderers\HSFrameRenderer.cs:17 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00118] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0008c] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:152 
  at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:151 
  at Xamarin.Forms.Platform.iOS
.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:134 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0002c] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00118] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <eb211aa32ac8429489411f4d642db9c2>:0 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer+UnevenListViewDataSource.CalculateHeightForCell (UIKit.UITableView tableView, Xamarin.Forms.Cell cell) [0x00035] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer
.cs:741 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer+UnevenListViewDataSource.GetEstimatedRowHeight (UIKit.UITableView table) [0x00095] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:685 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateEstimatedRowHeight () [0x0005f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:399 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateItems (System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Int32 section, System.Boolean resetWhenGrouped) [0x000bc] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:523 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:298 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnCollectionChanged (System.Collec
tions.Specialized.NotifyCollectionChangedEventArgs e) [0x0000a] in <6f4d3098293c4695a30698c64c576a90>:0 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnCollectionChangedGrouped (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x000e3] in <6f4d3098293c4695a30698c64c576a90>:0 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnProxyCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Boolean fixWindows) [0x00008] in <6f4d3098293c4695a30698c64c576a90>:0 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].OnProxyCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <6f4d3098293c4695a30698c64c576a90>:0 
  at Xamarin.Forms.ListProxy.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000a] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:233 
  at Xamarin.Forms.ListProxy+<>c__Displ
ayClass33_0.<OnCollectionChanged>b__0 () [0x00018] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:206 
  at Xamarin.Forms.ListProxy.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x000a0] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:225 
  at Xamarin.Forms.ListProxy+WeakNotifyProxy.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00031] in D:\agent\_work\1\s\Xamarin.Forms.Core\ListProxy.cs:394 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in <d599404e62be4a08928ab42b5cc0bc85>:0 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <d599404e62be4a08928ab42b5cc0bc85>:0 
  at System.Collections.ObjectModel.Ob
servableCollection`1[T].InsertItem (System.Int32 index, T item) [0x00024] in <d599404e62be4a08928ab42b5cc0bc85>:0 
  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in <7b5faf4072934b65b9f50c81038269d3>:0 
  at System.Collections.ObjectModel.ObservableCollectionExtensions.AddRange[T] (System.Collections.ObjectModel.ObservableCollection`1[T] collection, System.Collections.Generic.IEnumerable`1[T] items) [0x00013] in <8ea35f977c62491fa1dd61bf8dc76d00>:0
Comment 20 stanislav.svist 2017-11-14 16:08:44 UTC
Created attachment 25701 [details]
Bug reproduce sample
Comment 21 stanislav.svist 2017-11-14 16:10:27 UTC
Bug is happening when first group has no items.
Everything would go fine if you have first group with items, second empty, third empty, fourth not empty, etc.
But, if you have first group empty, when you add second one - you'll get an exception.
Comment 22 Dan Beaton 2017-11-15 22:17:57 UTC
Not sure if it helps, but I am also running into starting up my app. 

@Paul DiPietro [MSFT] 
Is this tracking on the same bug, or is there a new one we should be following?
Comment 23 Paul DiPietro [MSFT] 2017-11-15 22:22:46 UTC
The same.
Comment 24 stanislav.svist 2017-11-16 18:03:57 UTC
Any news?
Comment 25 Samantha Houts [MSFT] 2017-11-16 19:30:35 UTC
https://github.com/xamarin/Xamarin.Forms/pull/1275
Comment 26 stanislav.svist 2017-11-16 19:58:23 UTC
Great. When can we expect Nuget package?
Comment 27 Dan Beaton 2017-11-21 17:26:16 UTC
Do we have a Nuget release ETA? (I know, I hate it when my customers harass me like this). Do we? Do we?
Comment 28 Ray Kelly 2017-11-22 13:44:20 UTC
My project is stuck until this is resolved.  Please give us some idea when we will see this in a nuget package.
Comment 29 Ben Askren 2017-11-22 14:05:35 UTC
To those who (like me) can't use Xamarin.Forms 2.3.4 or newer until this bug is fixed, I would suggest rolling back to Xamarin.Forms 2.3.3 for all of your solution's projects.  Note that I have been able to successfully do this just for my solution's Android project but some work to the Android project's .csproj file.
Comment 30 Ben Askren 2017-11-22 14:06:42 UTC
My apologies, I meant to say iOS instead of Android.
Comment 31 David Ortinau [MSFT] 2017-11-22 14:29:00 UTC
I have confirmed PR 1275 resolves this issue. I've requested to get this merged and into the next service release.
Comment 32 Rui Marinho 2017-11-24 12:55:25 UTC
Should be fixed on 2.5.0-sr2
Comment 33 Rhi 2017-11-27 11:09:02 UTC
How do we get the 2.5.0-sr2 nuget for our projects ?
Comment 34 stanislav.svist 2017-12-16 14:20:07 UTC
Guys, I have tried 2.4.0.91020 and 2.5.0.121934 from Nuget and this bug is still NOT FIXED.
Comment 35 lars6wagner 2017-12-17 14:23:31 UTC
Can confirm that it is still NOT fixed in 2.5.0.121934.
Comment 36 Paul DiPietro [MSFT] 2017-12-17 19:14:55 UTC
Please file a new report on GitHub (https://github.com/xamarin/Xamarin.Forms/issues) with an updated reproduction of your particular scenario causing the crash. Thanks.
Comment 37 Samantha Houts [MSFT] 2017-12-18 18:45:38 UTC
The bug fix for this issue was not included in SR2 after all. It is available in SR3. You can test this release from GitHub: https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.5.0-sr3

If that does not resolve your issue, please open a new report on GitHub Issues as Paul mentioned in Comment 36.

Thanks!
Comment 38 Dan Beaton 2017-12-18 19:08:02 UTC
You're killing me Smalls 

;)

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