realm-dotnet: Invalid Transaction Exception

I have an update to a RealmObject in a write transaction, but I always get a “Realms.Exceptions.RealmInvalidTransactionException: ‘Cannot modify managed objects outside of a write transaction.’”

using (var trans = realm.BeginWrite())
{
      var convRef = realm.Find<Conversation>(conversation.ConversationId);
      convRef.TimeStatus = "relojGris.png"; //Exception raised here
      trans.Commit();
}

It is worth mentioning that this object is periodically on a background thread. I’ve tried doing the ThreadSafeReference.Create and resolving it and the problem still persists. I have this problem both on iOS and Android devices. I am using RealmVersion 5.1.2. Thanks again,

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

You’re right, my mistake I didnt see the convRef.realm. Now it always show as True. Let me work on the repo and I’ll drop it here when I have it done. Thanks again, Best Regards,