microsoft / microsoft/monaco-editor

[Bug] Editor throws error on dispose after upgrade from 0.51 to 0.52

Open
#4,702 6 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or 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

After upgrading from 0.51 to 0.52 we get an error when editor.dispose() is called. I also noticed that when I remove the onDidChangeModelContent listener we don't get the error. It seems that there is some async in here because if I dispose editor in a timeout then I don't get the error as well.
I tried our code in playground, and we couldn't reproduce which is weird too, as we don't have anything uncommon.

We dispose everything as following:

	if (this.modelChangeDisposable) {
            this.modelChangeDisposable.dispose(); // what editorInstance.onDidChangeModelContent returns.
         }
         editor.getModel().dispose();
	editor.dispose();
Screenshot 2024-10-02 at 14 52 05
Expected Behavior

No response

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the disposal sequence shown in the issue, especially the onDidChangeModelContent disposable, model disposal, and editor.dispose() after upgrading from 0.51 to 0.52. Try to reproduce the asynchronous error in the reporter's environment; done means identifying and preventing the dispose-time error without requiring a timeout or listener removal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.