We have noticed this exception occurring in our application that relies on NotifyOnStay but also changes the geofences being monitored fairly often (via StopMonitoringAllRegions -> StartMonitoring with the new geofence set) every 30minutes or so.
System.Collections.Generic.KeyNotFoundExceptionThe given key was not present in the dictionary.
System.ThrowHelper.ThrowKeyNotFoundException()
System.Collections.Generic.Dictionary<TKey, TValue>.get_Item(TKey key)
Geofence.Plugin.GeofenceImplementation.d__30.MoveNext()
This is just a small tweak to ensure that the region still exists in the internal dictionaries before accessing them after the Task.Delay so that the KeyNotFoundException isn't thrown.
Hey,
We have noticed this exception occurring in our application that relies on NotifyOnStay but also changes the geofences being monitored fairly often (via
StopMonitoringAllRegions
->StartMonitoring
with the new geofence set) every 30minutes or so.This is just a small tweak to ensure that the region still exists in the internal dictionaries before accessing them after the Task.Delay so that the KeyNotFoundException isn't thrown.
Thanks!