Skip to content

The JSON value could not be converted to AzureMapsControl.Components.Map.LightAnchor #106

Description

@marqdouj

I'm trying to call the Map.GetStyleOptionsAsync() function but get an error:

An exception occurred executing JS interop: The JSON value could not be converted to AzureMapsControl.Components.Map.LightAnchor. Path: $.light.anchor | LineNumber: 0 | BytePositionInLine: 59.. See InnerException for more details.

Code:

private async Task OnStyleChanged(MapStyleDataEventArgs args)
{
    try
    {
        State.MapStyle = await args.Map.GetStyleOptionsAsync();
    }
    catch (Exception ex)
    {
        ShowException(ex);
    }    
}

I setup the map using:

        EventActivationFlags="MapEventActivationFlags.None().Enable(
            MapEventType.Ready,
            MapEventType.SourceAdded, 
            MapEventType.ZoomEnd, 
            MapEventType.DragEnd,
            MapEventType.StyleData)"
        OnReady="OnMapReadyAsync"
        OnSourceAdded="OnDatasourceAdded"
        OnZoomEnd="OnCameraChanged"
        OnDragEnd="OnCameraChanged"
        OnStyleData="OnStyleChanged" />

Desktop

  • OS: Windows 11
  • Browser Edge: Version 130.0.2849.56 (Official build) (64-bit)
  • Visual Studio 2022 Version 17.12.0 Preview 4.0
  • .NET 9.0 Preview
  • AzureMapsControl.Components Version=1.16.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions