AzureMapsControl.Components icon indicating copy to clipboard operation
AzureMapsControl.Components copied to clipboard

Sample runtime failure Could not find 'azureMapsControl.Core.addMap' ('azureMapsControl' was undefined).

Open DavidThielen opened this issue 1 year ago • 3 comments

I've got the sample compiling and running. But on starting up it throws:

Microsoft.JSInterop.JSException: Could not find 'azureMapsControl.Core.addMap' ('azureMapsControl' was undefined).
Error: Could not find 'azureMapsControl.Core.addMap' ('azureMapsControl' was undefined).
    at https://localhost:7159/_framework/blazor.web.js:1:734
    at Array.forEach (<anonymous>)
    at l.findFunction (https://localhost:7159/_framework/blazor.web.js:1:702)
    at b (https://localhost:7159/_framework/blazor.web.js:1:5445)
    at https://localhost:7159/_framework/blazor.web.js:1:3238
    at new Promise (<anonymous>)
    at y.beginInvokeJSFromDotNet (https://localhost:7159/_framework/blazor.web.js:1:3201)
    at fn._invokeClientMethod (https://localhost:7159/_framework/blazor.web.js:1:62541)
    at fn._processIncomingData (https://localhost:7159/_framework/blazor.web.js:1:60016)
    at connection.onreceive (https://localhost:7159/_framework/blazor.web.js:1:53657)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
   at AzureMapsControl.Components.Runtime.MapJsRuntime.InvokeVoidAsync(String identifier, Object[] args) in C:\Git\AzureMapsControl.Components\src\AzureMapsControl.Components\Runtime\MapJsRuntime.cs:line 22
   at AzureMapsControl.Components.Map.AzureMap.OnAfterRenderAsync(Boolean firstRender) in C:\Git\AzureMapsControl.Components\src\AzureMapsControl.Components\Map\AzureMap.razor:line 429
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'MHbG-8tBm6VHLQaXUuHZm7aiZLgpGXhbD-f5DfYwShs'.

And this may be related. Visual Studio will not let me set a breakpoint in AppMap.razor. I can put it in MapJsRuntime which it calls. And on that break it shows AppMap.razor in the call stack. But can't set a breakpoint there.

Anyways, with this error, while the app runs, there's no map.

DavidThielen avatar Feb 26 '24 23:02 DavidThielen

Looks like you are missing the javascript component. My first would be that you only built the dotnet library itself, but not the typescript part. Can you please run npm run build and check if it makes any difference ?

Feel free to take a look at the development guidelines : https://github.com/arnaudleclerc/AzureMapsControl.Components/blob/develop/CONTRIBUTING.md#build-the-library

arnaudleclerc avatar Feb 28 '24 13:02 arnaudleclerc

Hi @arnaudleclerc

I had run the steps in the doc but not npm run build. I ran that too and it was successful, but still the same error. Any other ideas?

I am running from Visual Studio.

thanks - dave

DavidThielen avatar Feb 28 '24 21:02 DavidThielen

Hi @arnaudleclerc

I had run the steps in the doc but not npm run build. I ran that too and it was successful, but still the same error. Any other ideas?

I am running from Visual Studio.

thanks - dave

Hi, same error for me. I'm able to create the azure-maps-control.js library using npm and reference it inside the AzureMapsControl.Sample, but the sample project doesnt run. I tried with the 1.15.0 build

marco-manfroni avatar Apr 03 '24 15:04 marco-manfroni