Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unverified breakpoint (Breakpoint is set but not yet bound)

I had been successfully debugging my angular app in Chrome via Chrome Debugger extension with automatic created settings. But [something] happened, and after one of my Windows 7 reboots I got unactive breakpoints. I suppose that it was affected by Windows PATH environment variable change. Why I thinking so? I got a message like "PATH has a bad value, do you want to fix it?" when Windows started. Unfortunately I can't reproduce my old PATH value. It can be a coincidence, but after this case debugging does not work.

Breakpoints issue Breakpoints issue

No matter where a breakpoints are set: neither in the beginning of function or code block, nor in the middle of block, nor in a variable declaration, nor a variable operations. Breakpoints is not activated in noone of angular components: neither root component, nor others.

I use Google Chrome latest version. Interestingly, I installed the Debugger for Electron extension, which also starts up successfully, but the breakpoints are still not activated.

Other info:

Angular versions

launch.json:

    {
    "version": "0.2.0",
    "configurations": [       
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceFolder}",
            "trace": true,
            "sourceMaps": true,
        },
        {
            "type": "electron",
            "request": "launch",
            "name": "Launch Electron",
            "sourceMaps": true,
            "appDir": "H:/opened-in-VSCode-folder",
        },
    ]
}

Project folder structure:

Project structure

In launch.json also not works:

  • changing "webRoot" to "${workspaceFolder}/src", "${workspaceFolder}\\src", "${workspaceFolder}/dist" and a lot of others variants.
  • disabling or enabling "trace": true
  • disabling or enabling "sourceMaps": true

Additional reboots of Chrome, Windows, VSCode, reinstalling Angular and Electron don't leads to success. Antivirus stopped. Windows "Last successful login" did not help.

Thanks for any info.

UPD 1: The only word "error" in the vscode-chrome-debug.txt log file:

... 
  {"id":5,"result":{}} [09:54:38.267 UTC] ← From target:
  {"error":{"code":-32601,"message":"'Runtime.run' wasn't found"},"id":6}
  [09:54:38.267 UTC] ← From target:
  ...

UPD 2: Reinstalling windows not helped too. I guess the problem in the packages versions.

like image 703
Zhuravlev A. Avatar asked Feb 25 '19 10:02

Zhuravlev A.


People also ask

How do you activate a breakpoint?

To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.

Why does breakpoint not work?

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.

How do you skip to the next breakpoint?

Ctrl + F8 (Mac: Cmd + F8) Toggle breakpoint. Ctrl + Shift + F8 (Mac: Cmd + Shift + F8) View breakpoints.


2 Answers

For me was problem in another. When you are added launch.json, you can see webRoot variable that has a value ${workspaceFolder} by default. Lets check what does it mean in this source

${workspaceFolder} - the path of the folder opened in VS Code

and in my case angular project was inside folder of another project and when i tried to debug i get breakpoint is set but not yet bound message.

Note: **angular** folder not opened as root folder

And if you will open your angular project in VSCode explorer as root folder, your breakpoints will work.

enter image description here

Or if you don't want to open separate folder in VS Code explorer, you can specify in launch.json path to angular folder, like: ${workspaceFolder}/folder/folder/...

After this changes your debug should work.

like image 125
llotall Avatar answered Oct 04 '22 09:10

llotall


I solved the problem by updating some software:

  • VS Code: 1.37.1
  • Chrome: 69.0.3497.128
  • Node.js: 10.11.0
  • V8: 6.9.427.31
like image 33
Zhuravlev A. Avatar answered Oct 04 '22 11:10

Zhuravlev A.