Open drasticactions opened 1 year ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
I think I understand what's going on here:
UpdateItemsSource is being called multiple times by the PropertyHandlers: Once for the ItemSource, once for IsGrouped, and each time those clear out the underlying cells from the internal _measurementCells list.
I believe the order of operations is this:
Because of that, the underlying cells get recreated and readded to the LogicalChildren list. So the underlying platform item is removed from the list but not the virtual one.
Ideally, these should only be made once. I am still trying to figure out the best way to handle this. It feels very load-bearing, and any change to this will cause something else to blow up.
@PureWeen Do you have any ideas?
Verified this issue with VSM 17.6.7 (build 419). Can repro on iOS and maccatalyst platforms with sample project.
https://github.com/drasticactions/MauiRepros/tree/main/MauiCollectionView
Description
When a CollectionView ItemsSource is populated, UI Items are generated and registered in VisualDiagnostics. On iOS and Mac Catalyst, the first item in the given ItemSource is added to multiple items. The underlying UICollectionView is not creating it, but it does appear in LogicalChildren and IVisualTreeElement.Children as Virtual items. These views also appear in the Live Visual Tree and are being registered with OnChildAdd.
I could only reproduce this on iOS and Catalyst.
Steps to Reproduce
Run my reproduction project: https://github.com/drasticactions/MauiRepros/tree/main/MauiCollectionView
Link to public reproduction project repository
https://github.com/drasticactions/MauiRepros/tree/main/MauiCollectionView
Version with bug
7.0 (current)
Last version that worked well
7.0 (current)
Affected platforms
iOS, macOS
Affected platform versions
All versions
Did you find any workaround?
No response
Relevant log output
No response