I'm not certain about the OnMapReadyAsync
event. I'm assuming that this is your own event handler that's tied into the OnReady
property of the map, and not the same named property that is on the MapService
class called by the AddMapAsync
method here: https://github.com/arnaudleclerc/AzureMapsControl.Components/blob/776a40fc39fa4a6b8206dee98263b25d27a5e444/src/AzureMapsControl.Components/Map/MapService.cs Looking at the AddMapAsync
code, it looks like it loads the map and invokes the OnMapReadyAsync
event without waiting for the maps onready
event to fire. If using the MapService
, I could see this issue occurring.
It looks like this component is still pointing to version 2 of Azure Maps and I do recall one of the minor versions having a similar issue, but it was resolved in an update a day or two later, so possible this library is pulling in that minor version and not the latest. Near the end of version 3 the whole styling stack of the base maps in Azure Maps was rearchitected (after I moved to another team :)) and there were some bugs in a few versions of version 2. Those where resolved in the latest version of version 2, but version 3 has since had a lot of improvements and bug fixes. This library should work with version 3 without any issues. Getting it to use that version may resolve this issue (I can't reproduce this in issue in Azure Maps directly).
Another possible solution is to try the OnLoad event. The way the events work, OnReady fires as soon as enough of the maps resources are loaded to safely start adding layers and sources. The OnLoad event fires after all the maps resources have completely loaded (roughly one or two hundred milliseconds later depending on the performance of the device).