1

When trying to debug my code, stepping into a method causes the debugger to stop at some points for no reason. For example:

  • promiseInitHookWithDestroyTracking
  • promiseInitHook

(both from unknown source)

When stepping-over these "invisible" break points after 2-5 of them I usually get to the method I'm trying to debug.

I'm trying to make the debugger skip over these points. My debug configuration I'm using contains the property: (launch.json )

"skipFiles": [
                "<node_internals>/**"
            ]

Why is this happening, and how can I make it stop happening?

Example:

I created the following file called "test.js":

main();

async function main() {
    let i = await func();
    console.log(i);
}

async function func() {
    return 1;
}

My launch.json contains:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}/test.js",
            "outFiles": [
                "${workspaceFolder}/**/*.js"
            ]
        }
    ]
}

I'm adding screenshots to describe the issue.

When stopping on "let i = await func();" then stepping into I get to the followings: (look at the call stack)

after step into

after first step over

after second step over

after third step over

I expect to get to the state in the last screenshot immediately after stepping into, the debugger used to do so.

starball
  • 20,030
  • 7
  • 43
  • 238
dorefaeli
  • 11
  • 2
  • I don't think it has anything to do with the Node version, I'm using the same version for the past year. – dorefaeli Apr 20 '23 at 09:07
  • actually ok nvm I can reproduce even with NodeJS 18. I didn't initially read the step in your screenshots. Note that regressions with various software upgrades with various software are being used together. Ex. no NodeJS upgrade but VS Code upgrade. Case in point:https://stackoverflow.com/a/75748468/11107541 – starball Apr 20 '23 at 09:08

2 Answers2

0

Apparently it's a known bug in VSCode's latest version.

https://github.com/microsoft/vscode/issues/179293

dorefaeli
  • 11
  • 2
0

Cause

This is a bug in the vscode-js-debug extension (builtin to VS Code). See the issue ticket Error processing scopes: TypeError: cannot read properties of undefined (reading createScope ) #1643, which is fixed by the pull request fix: cannot read createScope of undefined #1644, where connor4312 states:

This was a race that was exposed because we were waiting for scripts in the stacktrace to come in. Turns in Node.js doesn't emit Runtime.executionContextCreated for its first context.

Refs nodejs/node#47438

This bug affects version 1.77.0 to 1.77.3 of VS Code. VS Code will bump its version of vscode-js-debug in the next release, which comes out in early may 2023

The issue ticket is duplicated in the VS Code repository as Javascript debugger pauses on promiseInitHookWithDestroyTracking (Unknown Source) when stepping into async function #179293.

Solutions

(pick one)

starball
  • 20,030
  • 7
  • 43
  • 238