I duplicated the existing TestRig with the exception of it being a Server (rather than WebAssembly) App. All works fine.
However, if I try to add markers to the map prior to viewing, the 'marker.AddTo' code throws an exception as JSBinder=null in Marker.CreateJsObjectRef
My noob understanding is that Interop should be available at the point OnAfterRenderAsync is called, but clearly everything isn't ready yet.
Any pointers are welcome.
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
var ll = new LatLng(-42, 175);
var marker = new Marker(ll, new MarkerOptions
{
Title = "Test"
});
await marker.AddTo(PositionMap);
}
Stack
Darnton.Blazor.Leaflet.dll!Darnton.Blazor.Leaflet.LeafletMap.Marker.CreateJsObjectRef() Line 36 C#
Darnton.Blazor.Leaflet.dll!Darnton.Blazor.Leaflet.InteropObject.BindJsObjectReference(Darnton.Blazor.Leaflet.LeafletMapJSBinder jsBinder) Line 31 C#
Darnton.Blazor.Leaflet.dll!Darnton.Blazor.Leaflet.LeafletMap.Layer.AddTo(Darnton.Blazor.Leaflet.LeafletMap.Map map) Line 20 C#
LeafletServerBlazorTestRig.dll!LeafletServerBlazorTestRig.Pages.Index.OnAfterRenderAsync(bool firstRender) Line 177 C#
I duplicated the existing TestRig with the exception of it being a Server (rather than WebAssembly) App. All works fine.
However, if I try to add markers to the map prior to viewing, the 'marker.AddTo' code throws an exception as JSBinder=null in Marker.CreateJsObjectRef
My noob understanding is that Interop should be available at the point OnAfterRenderAsync is called, but clearly everything isn't ready yet.
Any pointers are welcome.
Stack