Using Backlinks is only possible for managed(persisted) objects

We have upgraded to Latest Version of Realm .NET SDK in our Xamarin Forms App.
Replaced RealmObject to IRealmObject interface and updated corresponding classes/methods.

Everything was working fine with the older version but with upgrade we started getting below issues

  1. Cannot modify managed objects outside of write transaction (it was working with RealmObject class inheritance), See exception and stack trace in the attached file

But now a new issue is coming which I am not able to understand how to fix as it was working fine in the previous version. Please let us know if we have to make any specific changes for the BackLinks.
Error/Exception we are getting is as below :

Please let us know if any specific changes we have to make in the migration or provide us a link or document for migration guide.

We have upgraded to 10.20.00 from 10.13.00 .

For the Using backlinks is only possible for managed(persisted) objects error, the issue is that you’re attempting to access a backlinks property of an unmanaged object. This has never been supported as unmanaged objects wouldn’t have anything in the database linking to them, but we wanted to make this explicit by throwing an exception. Can you clarify in what situations you’re attempting to access the backlinks property - it’s possible we were too restrictive with this change.

Regarding Cannot modify managed objects outside of write transaction - when are you getting this error?

1 Like

Using backlinks is only possible for managed(persisted) objects : We don’t have any unmanaged object. We have simple .net classes implementing IRealmObject interface and IEquality interface.

Cannot modify managed objects outside of write transaction : This is coming when we are setting properties of class who implements IRealmObjects interface … Something like below

using var transaction = await GetTransaction();
var result = new SomeDTOClass{
RealmObjectTypeClass1Property1 = SomeObjectMapper.Adapt<RealmObjectTypeClass1>> (InstanceOfDtoClass),
RealmObjectTypeClass2Property2 = SomeObjectMapper.Adapt<RealmObjectTypeClass2>(InstanceOfDtoClass),
 RealmObjectTypeClass3Property3 = SomeObjectMapper.Adapt<RealmObjectTypeClass3>(InstanceOfDtoClass),
RealmObjectTypeClass4Property4 = SomeObjectMapper.Adapt<RealmObjectTypeClass4>(InstanceOfDtoClass),
}
transaction?.Commit();

So sometime it works fine and some time it rhows exception