[Bug] Error: InstantiationService has been disposed
Reproducible in vscode.dev or in VS Code Desktop?
- [X] Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- [X] Not reproducible in the monaco editor playground
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response
Reproduction Steps
No response
Actual (Problematic) Behavior
I'm getting the following console error when closing a modal containing a DiffEditor, AND I cant right-click to open context menu:
Error: InstantiationService has been disposed
at InstantiationService._throwIfDisposed (vendor-Be3X1PyW.js:5493:725)
at InstantiationService.createInstance (vendor-Be3X1PyW.js:5493:1454)
at vendor-Be3X1PyW.js:5503:89593
at createInstantHoverDelegate (vendor-Be3X1PyW.js:5059:42909)
at new ActionBar (vendor-Be3X1PyW.js:5104:8221)
at new QGe (vendor-Be3X1PyW.js:5104:17027)
at Object.render (vendor-Be3X1PyW.js:5469:1417)
at ContextView.show (vendor-Be3X1PyW.js:5019:18739)
at StandaloneContextViewService.showContextView (vendor-Be3X1PyW.js:5058:908)
at StandaloneContextViewService.showContextView (vendor-Be3X1PyW.js:5501:2414)
at ContextMenuHandler.showContextMenu (vendor-Be3X1PyW.js:5469:528)
at StandaloneContextMenuService.showContextMenu (vendor-Be3X1PyW.js:5469:4281)
at ContextMenuController_1._doShowContextMenu (vendor-Be3X1PyW.js:5536:8326)
at ContextMenuController_1.showContextMenu (vendor-Be3X1PyW.js:5536:7319)
at ContextMenuController_1._onContextMenu (vendor-Be3X1PyW.js:5536:7115)
at UniqueContainer.value (vendor-Be3X1PyW.js:5536:5893)
at InteractionEmitter._deliver (vendor-Be3X1PyW.js:4866:3915)
at InteractionEmitter.fire (vendor-Be3X1PyW.js:4866:4365)
at InteractionEmitter.fire (vendor-Be3X1PyW.js:4951:25168)
at ni.onContextMenu (vendor-Be3X1PyW.js:4951:21788)
at ViewUserInputEvents.emitContextMenu (vendor-Be3X1PyW.js:4919:60223)
at ViewController.emitContextMenu (vendor-Be3X1PyW.js:4919:47731)
at TouchHandler._onContextMenu (vendor-Be3X1PyW.js:4886:60775)
at vendor-Be3X1PyW.js:4886:57552
at HTMLDivElement.<anonymous> (vendor-Be3X1PyW.js:4883:62874)
at vendor-Be3X1PyW.js:4862:13
Editor Options:
{
wordWrap: 'on',
automaticLayout: true,
scrollBeyondLastLine: true,
scrollBeyondLastColumn: 0,
renderLineHighlightOnlyWhenFocus: true,
scrollbar: {
verticalScrollbarSize: 8,
horizontalScrollbarSize: 8,
},
smoothScrolling: true,
padding: {
top: 18,
bottom: 18,
},
minimap: {
enabled: false,
},
unicodeHighlight: {
invisibleCharacters: false,
ambiguousCharacters: false,
},
pasteAs: {
enabled: false,
},
experimentalInlineEdit: {
enabled: true,
showToolbar: "always"
},
}
Expected Behavior
No response
Additional Context
The error/issue is not present in versions <= 0.49.0.
@shincurry thanks for reporting; I am also getting this issue after upgrading a few weeks ago ... did you find a work-around?
downgrade to 0.49.0. 😐
OK, thanks for responding ... my scenario is exactly as per yours ... open code-editor-1, then open diff-editor-1 in a modal ... close modal ... after that, right-click in code-editor-1 raises the InstantiationService has been disposed. This only happens if the code-editor was opened before the diff-editor - opening a new code-editor-2 resolves the issue for both the new code-editor-2 and previously opened code-editor-1 instances.
I have the same issue. I have tried version 0.52.0, but it still does not work. I have to downgrade to 0.49.0.
Maybe it is the same issue. https://github.com/microsoft/vscode/issues/229026
Problem also sometimes happens in version 0.50.0. Here is a stack trace.
Error: InstantiationService has been disposed
Error: InstantiationService has been disposed
at n._throwIfDisposed (https://example.com/assets/monaco/min/vs/editor/editor.main.js:610:669)
at n.createInstance (https://example.com/assets/monaco/min/vs/editor/editor.main.js:610:1341)
at https://example.com/assets/monaco/min/vs/editor/editor.main.js:708:6736
at b (https://example.com/assets/monaco/min/vs/editor/editor.main.js:11:19055)
at new o (https://example.com/assets/monaco/min/vs/editor/editor.main.js:219:46144)
at new s (https://example.com/assets/monaco/min/vs/editor/editor.main.js:641:19846)
at ue._buildDomNode (https://example.com/assets/monaco/min/vs/editor/editor.main.js:685:703)
at new ue (https://example.com/assets/monaco/min/vs/editor/editor.main.js:683:164821)
at E._createFindWidget (https://example.com/assets/monaco/min/vs/editor/editor.main.js:685:19009)
at E._start (https://example.com/assets/monaco/min/vs/editor/editor.main.js:685:18355)
at _throwIfDisposed() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/platform/instantiation/common/instantiationService.ts:line 69:col 9
at this._getOrCreateServiceInstance() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/platform/instantiation/common/instantiationService.ts:line 119:col 7
at super() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/standalone/browser/standaloneCodeEditor.ts:line 297:col 82
at createInstantHoverDelegate() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/browser/ui/hover/hoverDelegateFactory.ts:line 37:col 8
at new o() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/browser/ui/findinput/findInput.ts:line 113:col 65
at constructor() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/platform/history/browser/contextScopedHistoryWidget.ts:line 80:col 2
at this._keybindingService.lookupKeybinding() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findWidget.ts:line 944:col 35
at new ue() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findWidget.ts:line 196:col 7
at _createFindWidget() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findController.ts:line 511:col 32
at _start() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findController.ts:line 464:col 8
at ErrorNoTelemetry.isErrorNoTelemetry() in https://example.com/assets/monaco/min/vs/editor/out-editor/vs/editor/file:/mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/errors.ts:line 26:col 11
Same here. I got this error when I have multiple editor instance opened and I switch their order on the screen
My case is creating 2 diff editors and then disposing of one of them. It works with hot reload that disposes of all instances and re-creating from scratch, so perhaps I should keep unused instances in a pool for re-use rather than disposing of them?
I got the same problem, when opening a diff editor in a modal dialog.
Seems to be fixed in v0.53.0?
Seems to be fixed in v0.53.0?
No, remains 100% reproducible in v0.53.0 (I followed steps here: https://github.com/microsoft/monaco-editor/issues/4612#issuecomment-2365061162)