21

I'm using VS Code on Windows 10, to debug both Python and React. The debugger is extremely slow to reach the first breakpoint, for both Python and JS/Chrome. The sequence of actions I'm observing is:

  1. VS Code's program tab lights up immediately

enter image description here

  1. The first breakpoint only gets reached/highlighed 10-60 seconds later. In between it hangs. I try to click anywhere on the screen but the application is frozen.

enter image description here

Extensions installed:

enter image description here

About:

enter image description here

gene b.
  • 10,512
  • 21
  • 115
  • 227

4 Answers4

17

This is a VS Code bug (one that I just spent hours diagnosing until I stumbled upon the workaround lol).

See: https://github.com/microsoft/vscode/issues/123257?_pjax=%23js-repo-pjax-container

Current workaround until May fix apparently:

Need to set the following in settings.json in VS Code

debug.focusWindowOnBreak: false

https://i.stack.imgur.com/Y223f.png

Scott Taylor
  • 171
  • 2
  • 2
    This isn't an ideal solution because my VS application icon doesn't light up. But if I go back to VS I see that the breakpoint is yellow and ready. In the alternative approach (grab/move title bar), the VS application icon does light up, I just need to move the VS window to see the breakpoint. Seems like this issue was temporarily fixed in June/July, and now it came back in the latest VS release. – gene b. Aug 11 '21 at 17:00
  • This is a perfect solution for me because I absolutely hate that windows doesn't allow me to disable screen jacking - this is a perfect 2 birds 1 stone fix for me – Sam Nov 14 '21 at 04:12
11

It looks like I found something that speeds it up. If I grab and move the title bar of VS Studio, the breakpoint gets reached and highlighted.

This is a preliminary finding, I'll edit it if I find something else.

enter image description here

gene b.
  • 10,512
  • 21
  • 115
  • 227
0

Here is how I solved similar issue, just for your reference.

  • Issue: When I try to debug node.js + angular application, the debugger takes very long time when starts node.js server before it reaches to the 1st breakpoint.
  • Reason: VS code scans all the JS files for a source map to typescript files.
  • Solution: In the launch.json configure "outFiles" to point to the JS files that you want to debug as .ts only.

Example:

{
    "type": "node",
    "request": "launch",
    "name": "Node",
    "program": "${workspaceRoot}/server/server.js",
    "cwd": "${workspaceRoot}",
    "runtimeArgs": ["--inspect-brk"],
    "runtimeExecutable": "node",
    "outFiles": [
        "${workspaceFolder}/server/lib/dist/*.js"
    ],
    "skipFiles": [
        "**/node_modules/**"
    ]
},
JerryG
  • 1
  • 1
0

I collapsed the "watch" panel (on the left side of a window) and removed all the variables. After this a speed (in debug mode) has been increased much!