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

While stepping, VS Code debugger periodically disconnects #1947

Closed
johncrim opened this issue Feb 23, 2024 · 4 comments
Closed

While stepping, VS Code debugger periodically disconnects #1947

johncrim opened this issue Feb 23, 2024 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s)

Comments

@johncrim
Copy link

johncrim commented Feb 23, 2024

Description
While stepping through code in VS Code, the debugger periodically detaches - program execution is stopped, but VS Code appears to be running, not on a breakpoint (the pause button is enabled but does nothing, and the play button is not visible). I am attached to Chrome, and if I switch to Chrome dev tools I can see the DevTools debugger stopped on the line that I expected to step to in VS Code.

If I continue stepping in Chrome I can often get to a point where the active line re-appears in VS Code, and then I can continue stepping in VS Code until this occurs again.

To Reproduce
Unfortunately I don't have a repro case, but I do have a consistent stack trace. Each time this happens, I see this error in the Extension Host Output window, which definitely seems related:

2024-02-22 16:53:00.619 [warning] TextEditor is closed/disposed
2024-02-22 16:53:15.249 [warning] TextEditor is closed/disposed
2024-02-22 16:53:21.159 [error] TypeError: Cannot read properties of undefined (reading 'includes')
	at t._shouldEnablePerScriptSms (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:115:26487)
	at t._onPaused (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:115:12074)
	at c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:115:9322
	at Y.fire (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:72:27848)
	at nh.emit (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:72:28225)
	at iv._processResponse (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:95:10654)
	at iv._onMessage (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:95:10333)
	at jt._onMessage (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:95:8307)
	at c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:95:7109
	at Y.fire (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:72:27848)
	at t.<anonymous> (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:139:31241)
	at Nv (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:53399)
	at t.n (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:52687)
	at t.emit (node:events:514:28)
	at DS.Aae (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:67389)
	at DS.emit (node:events:514:28)
	at DS.dataMessage (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:46076)
	at DS.getData (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:45224)
	at DS.startLoop (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:41880)
	at DS._write (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:41153)
	at writeOrBuffer (node:internal/streams/writable:392:12)
	at _write (node:internal/streams/writable:333:10)
	at DS.write (node:internal/streams/writable:337:10)
	at Socket.qv (c:\Users\redacted\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js:26:68095)
	at Socket.emit (node:events:514:28)
	at addChunk (node:internal/streams/readable:324:12)
	at readableAddChunk (node:internal/streams/readable:297:9)
	at Socket.push (node:internal/streams/readable:234:10)
	at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Based on this error, my guess is that script.url is undefined here:

if (script.url.includes('@vite/client')) {

Log File

Will review and try to provide...

VS Code Version:

Version: 1.86.2 (user setup)
Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda
Date: 2024-02-13T19:40:56.878Z
Electron: 27.2.3
ElectronBuildId: 26908389
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.22631

@johncrim johncrim added the bug Issue identified by VS Code Team member as probable bug label Feb 23, 2024
@johncrim
Copy link
Author

Lmk if you want the log - I can email it to you, but from looking at it the Extension Host output above seems a strong indicator. I think it is more useful than the JSON log, from looking at both.

To reiterate, every time I'm stepping and lose context, I get the stack trace above in the Extension Host window.

@johncrim
Copy link
Author

johncrim commented Feb 23, 2024

I can confirm that modifying the _shouldEnablePerScriptSms() fn in C:\Users\my_name\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\src\extension.js to:

_shouldEnablePerScriptSms(e){return e.data?.url?.includes("@vite/client")?!0:e.reason!=="instrumentation"||!br(e.data?.sourceMapURL)?!1:e.data.url?.startsWith("webpack")||e.data.url?.startsWith("ng:")}

By replacing .url => ?.url fixes this bug.

@connor4312
Copy link
Member

This is fixed on https://github.com/microsoft/vscode-js-debug#nightly-extension already!

@connor4312 connor4312 added the *duplicate Issue identified as a duplicate of another issue(s) label Feb 23, 2024
@johncrim
Copy link
Author

Can confirm this issue is fixed in the nightly extension. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

2 participants