Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Debugger Extremely Slow to Reach First Breakpoint

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

like image 940
gene b. Avatar asked May 19 '21 19:05

gene b.


People also ask

Why breakpoint is not hitting with VS code?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

Is VS code good for debugging?

One of the key features of Visual Studio Code is its great debugging support. VS Code's built-in debugger helps accelerate your edit, compile, and debug loop.

What happens when a breakpoint is reached when the debugger is enabled?

If a breakpoint is reached, or a signal not related to stepping occurs before count steps, stepping stops right away. Continue to the next source line in the current (innermost) stack frame. This is similar to step , but function calls that appear within the line of code are executed without stopping.

How do you run code until breakpoint?

Run to a breakpoint in code To set a simple breakpoint in your code, select the far-left margin next to the line of code where you want to suspend execution. You can also select the line and then select F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert Breakpoint.


2 Answers

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

like image 161
Scott Taylor Avatar answered Oct 19 '22 10:10

Scott Taylor


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

like image 11
gene b. Avatar answered Oct 19 '22 10:10

gene b.