Xamarin.forms: [CollectionView/ListView] Not listening for Reset command

Created on 3 Apr 2019  路  11Comments  路  Source: xamarin/Xamarin.Forms

Description

See issue: https://github.com/jamesmontemagno/mvvm-helpers/issues/39

Basic Information

Xamarin.Forms 3.6.0.264807
Visual Studio 2017 Version 15.9.10
Platforms:
iOS Simulator with iOS 12.1 (iPhone SE)

Reproduction Link

https://github.com/xamadev/ObservableRangeCollectionError

collectionview listview 6 bug

Most helpful comment

I am also still having this issue with a collection view. I am using Xamarin.Forms 4.1.0.581479.

Initially the observable collection is empty, then when new data arrives I call Clear and then add the new items.

I have also tried initialising the collection with some items and then calling reset with new items. The initial items display correctly but the new items cause the same error. Here is an Example Repo.

EDIT1: I have tested using the latest pre-release currently available (4.2.0.608146-pre1) and the issue still persists.

All 11 comments

The same issue with ListView (for ObservableRangeCollection from mvvm-helpers), replacing to ObservableCollection - works correctly.

I get the following error while using ObservableCollection with CollectionView

Objective - C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of items in section 0.The number of items contained in an existing section after the update(13) must be equal to the number of items contained in that section before the update(13), plus or minus the number of items inserted or deleted from that section (13 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section(0 moved in, 0 moved out).

@pfedotovsky This error usually happens (on iOS) when items are NOT being added to the underlying adapter/data source on the main thread.

Seems to work just fine on Android, which is interesting......

Seems to work just fine on Android, which is interesting......

Oh, I see what y'all are talking about now. Yes, Android does a NotifyDataSetChanged on Reset. Looks like I forgot to call ReloadData on iOS. Fix incoming ...

This issue still existed. Could you check again please ?

@Thanghand Which version of Forms are you using?

I am also still having this issue with a collection view. I am using Xamarin.Forms 4.1.0.581479.

Initially the observable collection is empty, then when new data arrives I call Clear and then add the new items.

I have also tried initialising the collection with some items and then calling reset with new items. The initial items display correctly but the new items cause the same error. Here is an Example Repo.

EDIT1: I have tested using the latest pre-release currently available (4.2.0.608146-pre1) and the issue still persists.

Also testing on the latest preview (due to bug in stable for android) and I have the same issue in ios now
4.4.0.991210-pre2

It's still happening on 4.7.0.1080(latest).

Was this page helpful?
0 / 5 - 0 ratings