CollectionView Faults With InvalidOperationException on Windows #26038
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
high
It doesn't work at all, crashes or has a big impact.
p/2
Work that is important, but is currently not scheduled for release
platform/windows 🪟
t/bug
Something isn't working
Milestone
Description
In trying to write a repro for a bug I created a simple CollectionView app. It works fine on Android but on Windows selecting an item by way of setting a property bound to CollectionView.SelectedItem (with Mode=TwoWay) faults with an InvalidOperationException with the message "Unexpected type for enumerator".
Steps to Reproduce
Clone the repository, build and run the app on Windows, you should see:
Click on the "Select First Item" button and it will fault.
In contrast, if you build and run it on Android and click on the "Select First Item" button it will simply select the first item.
Alternatively, if you first click on of the buttons labelled 'Button' the app will catch and ignore the exception, but the item will not be selected although the property will be updated. The values of the SelectedPerson Property and of CollectionView.SelectedItem are both displayed by the app. It's not clear to me whether this is the same problem or a different one, so I didn't raise a separate incident.
One other observation. If you run the app on Android you'll see this:
Note that OnCollectionViewScrolled has been called, allowing the app to see initial values. This initial call is helpful and does not happen on Windows.
Link to public reproduction project repository
https://github.com/david-maw/SimpleCollectionView-Exception.git
Version with bug
9.0.10 SR1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 11
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: