Crash in GeofenceImplementation.OnConnected callback NullReferenceException
Closed this issue · 1 comments
jasonmereckixpo commented
Our app has reported a crash, the exception is:
System.NullReferenceException: Object reference not set to an instance of an object
with the following stack trace:
GeofenceImplementation+<OnConnected>d__59.MoveNext ()
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state)
Since this seems to happen inside the OnConnected method, I'm guessing the issue is that accessing var location = await mFusedLocationProviderClient.GetLastLocationAsync();
is the problem
Because the instance variable mFusedLocationProviderClient is only initialized in the IsLocationEnabled method:
Seems possible to have OnConnected executed by a thread before IsLocationEnabled is executed (or would be executed by a different thread).
rdelrosario commented
@jasonmereckixpo Thanks for fixing this issue.