AdminUI: closing a tab with the script editor open logs [ERR] TaskCanceledException from MonacoEditor.DisposeAsync #902
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Seen on DEV vd03 (OtOpcUa
6c4d2990) on 2026-11-13, during the lmxopcua#700 deployed gate (recorddocs/deploy/2026-11-13-vd03-fea7de0a-to-6c4d2990.md,9375c9e2).What happened. The script editor (Monaco) was open in an AdminUI tab. Closing the tab, which ended the Blazor circuit, logged an
[ERR]line:TaskCanceledExceptionfromMonacoEditor.DisposeAsync.Why it matters. Nothing breaks, but it is noise at error level in the host log. Anyone reading the logs or alerting on
[ERR]will be misled.To do.
DisposeAsync, treat the JS-interop call failing because the circuit or page is already gone as expected: catchTaskCanceledException,JSDisconnectedExceptionandObjectDisposedException, and log at Debug or not at all.Fixed on
masterinb85e004b.Root cause.
MonacoEditor.DisposeAsync(src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/MonacoEditor.razor, was line 244) calledMonacoBlazor.disposethroughSafeInvokeAsync, which caught onlyJSDisconnectedException. When the tab closes the circuit is torn down mid-call, the call fails withTaskCanceledException, which escaped and was logged as an unhandled circuit exception at[ERR].Fix.
DisposeAsyncnow treatsJSDisconnectedException,OperationCanceledException(which coversTaskCanceledException) andObjectDisposedExceptionas the normal result of disposing on a gone circuit, and logs them at Debug. A realJSExceptionfrom a live page is still logged at Warning. TheDotNetObjectReferenceis released in afinally. Audit:MonacoEditoris the only component in the repo that uses JS interop (IJSRuntime/IJSObjectReference), so no other component needed the change.Tests. New bUnit tests in
MonacoEditorDisposeTests: dispose throwing each of the three exceptions does not escape and logs nothing above Debug, with a positive control that the failing call really ran. AJSExceptionstill logs a warning. Against the old code, all three gone-circuit cases fail.Not re-checked in a browser; the next deploy will confirm that the
[ERR]line is gone from the host log.Deployed to DEV vd03 + QA vq03/vq04 in
c9640f5con 2026-11-13.Live check on vd03: opened
/scripts/new(Monaco loaded), closed the tab without saving, then read the host log over SMB from just before the open to 3+ min after the close: 0MonacoEditor/Unhandled exception in circuitlines, 0[ERR]. Control: the6c4d2990build logged that[ERR]for the same action earlier the same day.Record:
docs/deploy/2026-11-13-vd03-qa-to-c9640f5c.md(c0ba450d).