Button which trigger shell backwards navigation causes the app to crash while CollectionView performs a scrolling animation.
Happens on iOS >= 15.0
Steps to Reproduce
Create ContentPage with the possibility go back
Set Shell.NavBarIsVisible="False"
Create StackLayout with Button which on click does Shell.Current.GoToAsync("..") and CollectionView with multiple Items.
Create enough items so when you swipe you can see scroll animation
Swipe to scroll items and while items are scrolling click the button (do this multiple times and app will crash)
Expected Behavior
App does not crash
Actual Behavior
On iOS app crashes
Basic Information
Version with issue: Xamarin.Forms Version="5.0.0.2545"
Last known good version: ?
Platform Target Frameworks:
iOS: 15.0, 16.1
Android:
UWP:
Android Support Library / AndroidX Version:
NuGet Packages:
Affected Devices:
StackTrace
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.ItemsViewController1[TItemsView].UpdateTemplatedCell (Xamarin.Forms.Platform.iOS.TemplatedCell cell, Foundation.NSIndexPath indexPath) [0x00031] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:278 at Xamarin.Forms.Platform.iOS.ItemsViewController1[TItemsView].GetCell (UIKit.UICollectionView collectionView, Foundation.NSIndexPath indexPath) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:94
at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/UIKit/UIApplication.cs:57
at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/UIKit/UIApplication.cs:92
at collectionviewtest.iOS.Application.Main (System.String[] args) [0x00001] in Desktop/collectionviewtest/collectionviewtest/collectionviewtest.iOS/Main.cs:17
Description
Button which trigger shell backwards navigation causes the app to crash while CollectionView performs a scrolling animation. Happens on iOS >= 15.0
Steps to Reproduce
Expected Behavior
App does not crash
Actual Behavior
On iOS app crashes
Basic Information
StackTrace
System.NullReferenceException: Object reference not set to an instance of an object at Xamarin.Forms.Platform.iOS.ItemsViewController
1[TItemsView].UpdateTemplatedCell (Xamarin.Forms.Platform.iOS.TemplatedCell cell, Foundation.NSIndexPath indexPath) [0x00031] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:278 at Xamarin.Forms.Platform.iOS.ItemsViewController
1[TItemsView].GetCell (UIKit.UICollectionView collectionView, Foundation.NSIndexPath indexPath) [0x00033] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:94 at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&) at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/UIKit/UIApplication.cs:57 at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/UIKit/UIApplication.cs:92 at collectionviewtest.iOS.Application.Main (System.String[] args) [0x00001] in Desktop/collectionviewtest/collectionviewtest/collectionviewtest.iOS/Main.cs:17https://user-images.githubusercontent.com/106705985/208873059-7f3a4d01-dff6-472c-9a6a-543e21679793.mov
Reproduction Link
collectionviewtest.zip