BlazorMonaco icon indicating copy to clipboard operation
BlazorMonaco copied to clipboard

Update from 3.2.0 to 3.3.0 throws error

Open osre77 opened this issue 9 months ago • 8 comments

Hello,

I have a Blazor Server project using 3.2.0 and I wanted to update to 3.3.0. When I open a page with the editor on it, I get the following error:

[2025-02-03T12:09:05.748Z] Error: Microsoft.JSInterop.JSException: Could not find 'blazorMonaco.editor.setWasm' ('setWasm' was undefined).
Error: Could not find 'blazorMonaco.editor.setWasm' ('setWasm' was undefined).
    at http://localhost:5055/_framework/blazor.web.js:1:537
    at Array.forEach (<anonymous>)
    at l.findFunction (http://localhost:5055/_framework/blazor.web.js:1:505)
    at b (http://localhost:5055/_framework/blazor.web.js:1:5248)
    at http://localhost:5055/_framework/blazor.web.js:1:3041
    at new Promise (<anonymous>)
    at y.beginInvokeJSFromDotNet (http://localhost:5055/_framework/blazor.web.js:1:3004)
    at gn._invokeClientMethod (http://localhost:5055/_framework/blazor.web.js:1:62730)
    at gn._processIncomingData (http://localhost:5055/_framework/blazor.web.js:1:60119)
    at connection.onreceive (http://localhost:5055/_framework/blazor.web.js:1:53760)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
   at BlazorMonaco.Helpers.JsRuntimeExt.SafeInvokeAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
   at BlazorMonaco.Editor.Global.Create(IJSRuntime jsRuntime, String domElementId, StandaloneEditorConstructionOptions options, EditorOverrideServices overrideServices, DotNetObjectReference`1 dotnetObjectRef)
   at BlazorMonaco.Editor.StandaloneCodeEditor.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Seems like the setWasm method is missing in js. This is a bit strange to me, since I am using a Blazor Server only project. My body section looks line in the documentation:

    <script src="_content/BlazorMonaco/jsInterop.js"></script>
    <script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js"></script>
    <script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"></script>

osre77 avatar Feb 03 '25 12:02 osre77