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

Error: Could not find 'azureMapsControl.Core.addMap on all versions greater than 1.16.1 (Preview V2 versions)

Open marqdouj opened this issue 1 year ago • 3 comments

Describe the bug If I upgrade my .NET 9 blazor app to use any version higher than 1.16.1 I get this error message in the browser console.

Error: 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:7177/_framework/blazor.web.js:1:384 at Array.forEach () at l.findFunction (https://localhost:7177/_framework/blazor.web.js:1:352) at _ (https://localhost:7177/_framework/blazor.web.js:1:5101) at https://localhost:7177/_framework/blazor.web.js:1:2894 at new Promise () at w.beginInvokeJSFromDotNet (https://localhost:7177/_framework/blazor.web.js:1:2857) at vn._invokeClientMethod (https://localhost:7177/_framework/blazor.web.js:1:65750) at vn._processIncomingData (https://localhost:7177/_framework/blazor.web.js:1:63139) at connection.onreceive (https://localhost:7177/_framework/blazor.web.js:1:56780) 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) at AzureMapsControl.Components.Map.AzureMap.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

To Reproduce Upgrade to any version higher than 1.16.1 and run the app

Expected behavior Upgrading should not cause the error.

Screenshots

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Edge, Version 131.0.2903.112

Additional context I could not see any difference in the readme for the scripts I was already using for 1.16.1 - is the readme up to date for script versions?

marqdouj avatar Jan 12 '25 15:01 marqdouj

Thanks for opening the issue. I am aware the current preview versions of the V2 are not functional because the scripts are not included within the nugget package anymore. I don't really understand why so far. In the meantime, the preview versions of V2 don't bring anything new compared to the V1 so far, so I would recommend sticking with the V1 for now.

arnaudleclerc avatar Jan 12 '25 15:01 arnaudleclerc

Ok, thanks

marqdouj avatar Jan 12 '25 16:01 marqdouj

fwiw, I cloned the 1.16.1 and latest preview version to compare. What I found was that in Visual Studio this typescript line showed no errors in 1.16.1 but showed errors in the preview version:

import * as azmaps from 'azure-maps-control';

1.16.1 version: image

Preview Version: image

Hope this helps.

marqdouj avatar Jan 13 '25 13:01 marqdouj

This issue has now been fixed starting from the v.1.17.1. All future versions should now have the web assets included.

arnaudleclerc avatar Mar 10 '26 17:03 arnaudleclerc