Xamarin.forms: [Bug] CollectionView Items are reversed on AddRange

Created on 22 May 2020  路  6Comments  路  Source: xamarin/Xamarin.Forms

Description

Using the AddRange method to optimize the insert of elements in an ObservableCollection binded to CollectionView adds them in reverse order.

I've tried with two different implementations of Range ObservableCollection, same issue:

Expected Behavior

Items are added in order with AddRange.

Actual Behavior

Items are added and removed in reverse order.

Basic Information

  • Version with issue: 4.6.0.800
  • Last known good version: -
  • IDE: Visual Studio 2019 16.6.0
  • Platform Target Frameworks:

    • iOS: (only tested on UWP)

    • Android: (only tested on UWP)

    • UWP: 16299

Screenshots

With multiple Add on ObservableCollection

2zP8mzuwKk

With AddRange on ObservableCollection

HR3C7AUvav
(items are added in reverse order and remove it in reverse order as well)

Reproduction Link

CollectionView AddRange sample

collectionview 2 UWP bug

All 6 comments

@YZahringer Thanks for the reproduction sample. I have done several tests and can reproduce the issue using 4.6 and 4.7-pre2.

Captura de pantalla 2020-06-02 a las 13 55 36

Then, I have created a tests in Xamarin.Forms Core Gallery using the MvvmHelpers ObservableRangeCollection code and, cannot reproduce the issue:
https://gist.github.com/jsuarezruiz/bbed609b8382a72c6304c4244f48b964
Captura de pantalla 2020-06-02 a las 13 56 16
I will check if it has been fixed by another issue fix, etc.

@jsuarezruiz Thank you for the answer. In the test there is no ItemTemplate defined, perhaps without it does not reproduce the problem?

You are right. Using strings I didn't notice the ItemTemplate in your example.
So, using ItemTemplate, can reproduce in Core Gallery too.

Any news on this? We鈥檙e using ObservableRangeCollection for a reason...

any plans on when this will get fixed? This is a pretty critical blocker for me at the moment.

Repro project updated to XF 4.8.0.1269 (issue persist)

Was this page helpful?
0 / 5 - 0 ratings