microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.2k stars 3.58k forks source link

[Bug] Error: InstantiationService has been disposed #4612

Open shincurry opened 2 months ago

shincurry commented 2 months ago

Reproducible in vscode.dev or in VS Code Desktop?

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.

ihqtim commented 3 weeks ago

@shincurry thanks for reporting; I am also getting this issue after upgrading a few weeks ago ... did you find a work-around?

shincurry commented 3 weeks ago

downgrade to 0.49.0. 😐

ihqtim commented 3 weeks ago

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.