Realm .Net SDK || Not a read transaction

23 Views Asked by At

We are using realm in our Xamarin Forms project. Its working good but randomly we are getting few issues which actually we are not able to identify the cause. Here is scenario: we are adding and updating items in to different realm tables using for loop. It works fine and out of 10 actions, it fails in 1 or 2 actions and app crashes and doesn't provide any info that from where it is actually breaking. I tried with all exceptions ON in visual studio (VS 2022, Professional on Windows) but still it doesn't break and doesn't provides and stack trace. . Below is the error we are getting :

[libc++abi] terminating with uncaught exception of type realm::WrongTransactionState: Not a read transaction

I have subscribed the error event but it is not coming into that block

Realm().Error+=(s,e)=>{
     Debug.WriteLine($"Error: {e.Exception.Message} and stack : {e.Exception.StackTrace}");  
}

Is there any way I can catch this exception and prevent app from crashing ? Not only this but I want to catch any other unhandled exception from the Realm which crashes the App?

0

There are 0 best solutions below