This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Regression] CollectionView NSRangeException #11311
Labels
4.6.0
regression on 4.6.0
a/collectionview
excellent-report
i/regression
in-progress
This issue has an associated pull request that may resolve it!
t/bug 🐛
Milestone
Description
In Xamarin.Forms v4.7.0.1080 and v4.7.0.968, on iOS, an
NSRangeException
is thrown when aCollectionView.ItemSource
is updated:Steps to Reproduce
CollectionViewBoundsExceptionRepro.sln
CollectionViewBoundsExceptionRepro.iOS
to an iOS Simulator or DeviceNSRangeException
is thrown on launchExpected Behavior
CollectionView.ItemSource should update without throwing an Exception
Actual Behavior
CollectionView.ItemSource throws
NSRangeException
Basic Information
Screenshots
Reproduction Link
https://github.com/brminnick/CollectionViewBoundsExceptionRepro
Work Arounds
Option #1. Downgrade Xamarin.Forms
Downgrade to Xamarin.Forms v4.7.0.937-pre4
Option #2. Remove CollectionView.Footer
Set
CollectionView.Footer = null
CollectionViewPage.cs
, changeFooter = new BoxView { BackgroundColor = Color.Red, HeightRequest = 53 }
toFooter = null
https://github.com/brminnick/CollectionViewBoundsExceptionRepro/blob/8a6636d7af57f289113e800cfa0d0160cad78d6d/Src/CollectionViewBoundsExceptionRepro/CollectionViewPage.cs#L17
Option #3. Replace
IEnumerable<int>
withObservableCollection<int>
CollectionViewModel.cs
, removepublic IEnumerable<int> ScoreCollectionList
CollectionViewModel.cs
, removeIEnumerable<int>? _scoreCollectionList;
CollectionViewModel.cs
, addpublic ObservableCollection<int> ScoreCollectionList { get; } = new ObservableCollection<int>()
CollectionViewModel.cs
, inExecuteRefreshCommand
refactor logic forObservableCollection
:Replace this code:
with this code:
The text was updated successfully, but these errors were encountered: