microsoft / MapsSDK-Unity

This repository contains samples, documentation, and supporting scripts for Maps SDK, a Microsoft Garage project.
MIT License
654 stars 128 forks source link

Expose an event for "Unable to download map data" errors? #186

Closed meta-meta closed 1 year ago

meta-meta commented 2 years ago

I am working on making a VR app resilient to network disconnect. What I'm seeing is that when the connection is lost, MapsSDK is spamming the Unity log with hundreds of these: Unable to download map data: Cannot connect to destination host, 0, isHttpError: False, isNetworkError: True.

I can disable the map to prevent MapsSDK from making requests but it takes a few seconds for my app to detect offline. Meanwhile, MapsSDK has logged a few hundred of these errors. I suspect this is causing our framerate to drop.

Can MapsSDK expose an event so that I can turn the map off?

Alternatively, is there a way to configure it to exponential backoff requests when one or more have failed?

Full error:

Unable to download map data: Cannot connect to destination host, 0, isHttpError: False, isNetworkError: True
UnityEngine.Debug:LogError (object)
=aaAD=`2/=ba09=`2/=ba35=`2<=aa5=, =aD=>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Nullable`1<=aa5=>>:SetException (System.Exception)
=a97=/=ba05=:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a5F=>:SetException (System.Exception)
=a53=/=baFC=:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=aed=>:SetException (System.Exception)
=aef=/=bab8=:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=aE6=>:SetException (System.Exception)
=aef=/=bab9=:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=aE6=>:SetException (System.Exception)
=aab7=/=ba15=:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a48=>:SetException (System.Exception)
=aab7=/=ba16=:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a48=>:SetException (System.Exception)
=aa2f=/=ba41=`1<object>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a48=>:SetException (System.Exception)
=aaeE=/=ba26=`1<object>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a48=>:SetException (System.Exception)
=a85=/=ba0c=`1<object>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a84=>:SetException (System.Exception)
=a85=/=ba0d=`1<object>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a84=>:SetException (System.Exception)
=a85=/=ba0E=`1<object>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a84=>:SetException (System.Exception)
=a83=/=baf9=`1<object>:MoveNext ()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<=a84=>:SetException (System.Exception)
=a83=/=ba0B=:MoveNext ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
kircher1 commented 1 year ago

190 is a similar idea. The suggested workaround there could work here too, which is to use Unity's log callback to detect these messages and use that to disable the map.