Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] CollectionViewRenderer ArgumentsOutOfRangeException #15567

Open
fntc opened this issue Oct 17, 2022 · 2 comments
Open

[Bug] CollectionViewRenderer ArgumentsOutOfRangeException #15567

fntc opened this issue Oct 17, 2022 · 2 comments
Labels
a/collectionview s/unverified New report that has yet to be verified t/bug 🐛

Comments

@fntc
Copy link
Contributor

fntc commented Oct 17, 2022

Description

CollectionViewRenderer on iOS will crash the application when the ObservableItemsSource changes while it is recalculation the layout.

SIGABRT: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
MyFancyComplexDataList.get_Item (System.Int32 index)
ObservableItemsSource.ElementAt (System.Int32 index)
ObservableItemsSource.get_Item (System.Int32 index)
ObservableItemsSource.get_Item (Foundation.NSIndexPath indexPath)
ItemsViewController1[TItemsView].GetSizeForItem (Foundation.NSIndexPath indexPath) ItemsViewDelegator2[TItemsView,TViewController].GetSizeForItem (UIKit.UICollectionView collectionView, UIKit.UICollectionViewLayout layout, Foundation.NSIndexPath indexPath)
(wrapper managed-to-native) ObjCRuntime.Messaging.objc_msgSendSuper(intptr,intptr)
UICollectionViewLayout.PrepareLayout ()
ItemsViewLayout.PrepareLayout ()
(wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName)
UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass)
Application.Main (System.String[] args)

Steps to Reproduce

  1. List with data for CollectionView that changes (clear, add, remove) a lot
  2. Recalculation of CollectionView in progress while List gets cleared
  3. ArgumentOutOfRangeException -> App crash

Expected Behavior

Handle ArgumentOutOfRangeException gracefully, returning default item.

Actual Behavior

Renderer Crashing on ArgumentOutOfRangeException

Basic Information

  • Version with issue: 5.0.0 SR12
  • Last known good version: unknown
  • Platform Target Frameworks:
    • iOS:

Build Logs

Workaround

CollectionView.IsVisible=false
Change Data
CollectionView.IsVisible=true

reduces the amount of crashes

@fntc fntc added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 17, 2022
@felipemomm
Copy link
Contributor

Facing the same issue here when using several CollectionViews. Is it possible to review the PR related to this ticket?

@Jakar510
Copy link

Jakar510 commented Oct 5, 2023

Facing the same issue here when using several CollectionViews. Is it possible to review the PR related to this ticket?

As am I

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/collectionview s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@fntc @jsuarezruiz @felipemomm @Jakar510 and others