Skip to content
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

Problem of EmbeddedObject nested collection binding (.net Xamarin Forms) #2840

Closed
aliegeni opened this issue Mar 6, 2022 Discussed in #2839 · 8 comments · Fixed by #2841
Closed

Problem of EmbeddedObject nested collection binding (.net Xamarin Forms) #2840

aliegeni opened this issue Mar 6, 2022 Discussed in #2839 · 8 comments · Fixed by #2841
Assignees

Comments

@aliegeni
Copy link

aliegeni commented Mar 6, 2022

Discussed in #2839

Originally posted by aliegeni March 6, 2022
Despite official docs says: "You can use the same embedded object type in multiple parent object types and you can embed objects inside of other embedded objects."
You get the RealmInvalidObjectException: "Can't enumerate the collection because it was deleted or the Realm it is contained in has been closed." when trying to update parent RealmObject with EmbededObject member witch has inside List of other embedded objects.
That makes "live" data binding impossible in Xamarin Forms! Is there any workaround?

Project to reproduce the issue.
https://github.com/aliegeni/RealmXamarinTest

@nirinchev
Copy link
Member

Can you share your project?

@aliegeni
Copy link
Author

aliegeni commented Mar 6, 2022

Can you share your project?

https://github.com/aliegeni/RealmXamarinTest

@nirinchev
Copy link
Member

You can't have multiple objects referencing the same embedded object. In your repository you're adding the same track to multiple albums and the same album to multiple artists.

@aliegeni
Copy link
Author

aliegeni commented Mar 6, 2022

That not the case! It is not possible even to add same instance of embedded object to multiple realms! That why there is deep cloning at the and of repository GetData() function . My repository is just for mimic web API response that return deserialized JSON data as unmanaged RealmObject.
Issue is related about already managed nested list iteration.

To convince you, just updated my project to more straight forward repository.

@nirinchev
Copy link
Member

nirinchev commented Mar 6, 2022

My bad - I misunderstood where the original problem was manifesting. I can see the actual issue now and it seems to be databinding related. Should be simple to workaround.

(Also, sorry if you had already shared your project in the first post - the Github mobile app sometimes truncates messages and must have missed it.)

@sync-by-unito
Copy link

sync-by-unito bot commented Mar 8, 2022

➤ Andrea Catalini commented:

Fixed by #2841

@PawKanarek
Copy link

@nirinchev Do you know when will be available new Realm Nuget package with this fix? I have the same issue, app is crashing & i don't know how to make workaround :(

@nirinchev
Copy link
Member

We're wrapping up a few in-flight PRs and will do a release shortly after. Either this week or early next one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants