Realm Sync .NET - Freezing an object on a synced realm messes the properties up

I have a synced realm that has the following realm object:

When I call .Freeze() on an instance of this object and then try and access the properties I get a System.InvalidCastException. Here is a screenshot of the object instance in debugger

image

It looks like freezing the object seems to mess up the mapping so the properties on the realm file map to the incorrect corresponding object property in the Realm.

Is this a known bug? If so, is there a workaround so this doesn’t happen?

This is definitely not expected. Do you think you can extract a minimal repro case that we can run locally and debug?

Hi, how would I do that?

If you can create a self-sufficient console application that demonstrates the issue, that would be best. If that is impossible and you would be open to sharing your complete project, we could give you an upload link to securely share it. Finally, if neither of those are options, if you could share your complete schema as well as the code you use to open a Realm, we could try and repro from that.

Hi,
I’ve recreated the error in a console app. How can I share the error with you? (it doesn’t let me attach zips on this site)

You can attach the .zip to the github issue I created or just upload it to some 3rd party hosting service, such as google drive and share the link here. This is assuming the project doesn’t contain any credentials or secrets. If it does, then I’ll need your email address to email you a secure upload link.

Hi,
I attached the link on the github issue, but I’ll also attach it here https://github.com/JamieColclough/Frozen-object-has-incorrect-property-indices/tree/main/RealmSyncFreezeError I couldn’t upload the packages but hopefully you can build the project with this