New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Crash during Render after adding items to an ObservableCollection #10163
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I'm also experiencing this error. In my testing it seems like the error only happens on iOS and specifically affects Collection Views with Grouped data when you clear the observable collection then add an item. You can see that it has to do with the collection view grouping in my test repository by toggling the CollectionView's Steps to Reproduce:
|
Experiencing the same issue just on iOS with a grouped CollectionView bound to an ObservableCollection. |
+1 Also experiencing this |
+1
|
I've also seen this crash. Wrapping the Adding of items within a |
Does not work for me. |
I hadn't tried the sample earlier. The following works for me as a work-around in that sample:
The main change being adding a delay between clearing the list and adding new items. |
I'm using ObservableRangeCollection from MvvmHelpers. So I cannot do this kind of hack easily. |
+1 this is becoming a big issue for us |
My workaround for now is to add the group headers as items to the list and use a datatemplateselector. Alternatively set a boolean on the first item of each group and create a template for first items that includes the group header template. That way the length of the list is not modified if that matters. |
I had a similar crash. My workaround was just to recreate the ObservableCollection fresh rather than clearing and adding. |
Same problem here and it looks like this is an inherited problem from Xamarin Forms. I don't have this issue if I use a |
Same problem as @imsam67 |
Any solution yet? |
I solved this problem by making the collection a type that inherits from an ObservableObject, any changes to the object will then change in the collection. |
Hi Ian. Could you please elaborate on what you did. Did you create a class that inherited from ObservableObject or from ObservableRangeCollection? |
Yes, I created a class eg |
Doesn't work for me, same error as before :( |
Unfortunately, the bug still occurs with the latest MAUI version. Environment:
How to reproduce:
Note:
Output:
|
Neither invoking on main thread or adding a delay between the clear and add worked for me. But swapping the entire groups collection did. I just implemented it as a notifying property.
Then replace the entire List with another one that contains the new groups. It may also work if you manipulate your observable collection directly via the Items property and then manually fire the change event. It seems this is a new exception in iOS 16.4, plenty of Swift devs are reporting the same problem. |
Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you! |
Description
I get the following crash after adding items to an ObservableCollection for the NewsReader app.
Related: #4756 (Maybe this commit did not solve all cases: cf2d2cd)
Crash:
Steps to Reproduce
Link to public reproduction project repository
https://github.com/jbe2277/waf/tree/5a957034c1d92f45402c2069e180fecdc54873d0
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 15
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: