RealmResultsVisitor.TryExtractConstantValue Error


#1

I noticed in my App Center logs a lot of errors related to

RealmResultsVisitor.TryExtractConstantValue (System.Linq.Expressions.Expression expr, System.Object& value)
System.Reflection.TargetException: Non-static method requires a target.

I’m passing an Id into my Fragment using the New Instance Pattern, and then the data is retrieved from
the realm. I don’t seem to be getting the error all the time, which is causing me some headaches trying to pin it down.

I suspect the error is caused in the where clause of the lambda expression, but I don’t understand why this is. Any feedback is much appreciated.

My code in the offending method is pretty simple

     var patrolId = Arguments.GetString(BundleArguments.PatrolId);
     _patrol = _realm.Find<Patrol>(patrolId);
     _points = _realm.All<PatrolPoint>().Where(x => x.Patrol_Id == _patrol.Id).ToList();

Stack trace


#2

Looking at your code - seems like this could be triggered when _patrol is null. Can you add a null-check for it and see if you still manage to get the error?