Update from 3.2.0 to 3.3.0 throws error
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>
I have the same problem
Ditto here too. Also using Blazor Server. I went through the setup steps and verified everything was configured correctly.
See https://github.com/serdarciplak/BlazorMonaco/issues/152
Didn't get a chance to try this, but having to clear the browser cache after a server update is probably not accepted by the users.
Personally I had to clear only my local cache during development (actually I just did force reload). There was no problem in production after upgrading the library.
I will try on Monday.
Clearing the browser cache solved the problem for me.
I finally got around to test updating to 3.3.0 again and now it works.
@osre77 So this issue is not relevant anymore and can be closed? (@serdarciplak)
@denispaluca yes, the issue is solved.