realm-dotnet: [Bug]: NullReferenceException in a loop
What happened?
NullReferenceException in a loop
Repro steps
I have a hard time creating a 100% repro step, however this is the situation i’m having:
I have a ‘highly’ concurrent setup, where items are added / updated / removed by multiple threads.
In one of the threads I then loop over all items, using:
using (var realm = Realm.GetInstance())
{
var models = realm.All<MyModel>();
foreach (var model in models)
{
//model is sometimes NULL here
// or model is 'no longer valid'
}
}
How can I make this access safe ?
Version
10.9.0
What SDK flavour are you using?
Local Database only
What type of application is this?
Xamarin
Client OS and version
iOS 15.3
Code snippets
No response
Stacktrace of the exception/crash you’re getting
No response
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
Phew, thanks for the confirmation. I wrote up a test in the mean time and can confirm the behaviour is as we expect, and also as you mention regarding the implicit refresh on write: