Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors.js:12 Uncaught Error: Could not find source file: 'inmemory://model/1'. #1842

Closed
Prinzhorn opened this issue Feb 19, 2020 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug typescript
Milestone

Comments

@Prinzhorn
Copy link

Probably related to #1840? I'm using Svelte and not React, but it doesn't matter. This is about quickly disposing an editor after creating it. E.g. in my app if I click very fast the component is unmounted very quickly, causing a call to dispose to clean the component up, which will spit out the error in the console.

monaco-editor version: 0.20.0
Browser: Chrome 80.0.3987.106
OS: Ubuntu 19.10
Playground code that reproduces the issue:

Paste into playground and hit "Run" > 1 times.

let editor = monaco.editor.create(document.getElementById('container'), {
  value: '_',
  language: 'javascript'
});

requestIdleCallback(function() {
  editor.dispose();
});

Minimal example also here: https://github.com/Prinzhorn/monaco-could-not-find-source-file

In Chrome I get this error consistently every single time (in Playground I sometimes need to "Run" twice)

Selection_589

errors.js:12 Uncaught Error: Could not find source file: 'inmemory://model/1'.

Error: Could not find source file: 'inmemory://model/1'.
    at y (ts.worker.js:82)
    at Object.getCodeFixesAtPosition (ts.worker.js:82)
    at t.getCodeFixesAtPosition (ts.worker.js:86)
    at n.fmr (ts.worker.js:74)
    at e._handleMessage (ts.worker.js:15)
    at Object.handleMessage (ts.worker.js:15)
    at r._handleMessage (ts.worker.js:15)
    at r.handleMessage (ts.worker.js:15)
    at e.onmessage (ts.worker.js:15)
    at self.onmessage (ts.worker.js:76)
    at errors.js:12

(anonymous) @ errors.js:12
setTimeout (async)
ErrorHandler.unexpectedErrorHandler @ errors.js:10
ErrorHandler.onUnexpectedExternalError  @ errors.js:29
onUnexpectedExternalError @ errors.js:45
(anonymous) @ codeAction.js:142
step  @ codeAction.js:49
(anonymous) @ codeAction.js:30
rejected  @ codeAction.js:22
Promise.then (async)
step  @ codeAction.js:23
(anonymous) @ codeAction.js:24
__awaiter @ codeAction.js:20
(anonymous) @ codeAction.js:123
getCodeActions  @ codeAction.js:123
(anonymous) @ codeActionModel.js:188
createCancelablePromise @ async.js:13
(anonymous) @ codeActionModel.js:188
CodeActionOracle._createEventAndSignalChange  @ codeActionModel.js:125
CodeActionOracle.trigger  @ codeActionModel.js:43
CodeActionModel._update @ codeActionModel.js:194
(anonymous) @ codeActionModel.js:159
Emitter.fire  @ event.js:509
LanguageFeatureRegistry.register  @ languageFeatureRegistry.js:43
registerCodeActionProvider  @ standaloneLanguages.js:289
setupMode @ languageFeatures.js:913
setupJavaScript @ languageFeatures.js:913
(anonymous) @ monaco.contribution.js:203
Promise.then (async)
LazyPromise.then  @ bundle-loader.js:77
(anonymous) @ monaco.contribution.js:203
(anonymous) @ standaloneLanguages.js:42
Emitter.fire  @ event.js:509
ModeServiceImpl._getOrCreateMode  @ modeServiceImpl.js:105
ModeServiceImpl._createModeAndGetLanguageIdentifier @ modeServiceImpl.js:93
(anonymous) @ modeServiceImpl.js:80
LanguageSelection @ modeServiceImpl.js:31
ModeServiceImpl.create  @ modeServiceImpl.js:78
createModel @ standaloneEditor.js:101
StandaloneEditor  @ standaloneCodeEditor.js:192
(anonymous) @ standaloneEditor.js:58
withAllStandaloneServices @ standaloneEditor.js:45
create  @ standaloneEditor.js:57
parcelRequire.index.js.monaco-editor  @ index.js:21
newRequire  @ monaco-could-not-fin…file.e31bb0bc.js:47
(anonymous) @ monaco-could-not-fin…file.e31bb0bc.js:81
(anonymous) @ monaco-could-not-fin…ile.e31bb0bc.js:120
@Prinzhorn
Copy link
Author

In Playground it happens in Firefox 73.0 as well

Selection_590

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug typescript labels Feb 19, 2020
@mehulmpt
Copy link

I can confirm this too. It happens (sometimes only) when I run e2e tests using Cypress.

Screenshot 2020-04-19 at 8 44 00 PM

@Javey
Copy link
Contributor

Javey commented Apr 20, 2020

The same with me. When we quickly dispose the eidtor, the worker is still alive.

@leeyang1990
Copy link

leeyang1990 commented Jul 29, 2020

just set a temp modal after create the editor

let model = monaco.editor.createModel("console.log('hello,world')");
editor.setModel(model);

@alexdima alexdima self-assigned this Sep 18, 2020
@alexdima alexdima added this to the August 2020 milestone Sep 18, 2020
@alexdima
Copy link
Member

Duplicate of #1638, because this is also fixed by microsoft/monaco-typescript@0ac03ae

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug typescript
Projects
None yet
Development

No branches or pull requests

5 participants