Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode - Chrome Debug - Unverified Breakpoint

I have a problem with debugging my angular component inside .ts file. I'm using VSCode and Debugger for Chrome extension.

Here is my vscode launch file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome",
            "url": "http://localhost:5000",
            "sourceMaps": true, 
            "webRoot": "${workspaceRoot}"        
        }
    ]
}

Here is my tsconfig.json file:

{
  "compile": true,
  "comments":true,
  "module": "none",
  "target": "es5",
  "sourceMap": true,
  "sourceRoot": "",
  "mapRoot": "",
  "declaration": false
}

Inside angular component, I've set a breakpoint in $onInit cycle:

$onInit = () => {
  for(let i = 0; i < 5; i++) { //here I put breakpoint
    let t = i;
  }
}

Debus starts successfully (chrome opens) but nothing happens. In my editor, if I hover over breakpoint, the tooltip shows with a message: Unverified breakpoint. Breakpoint set but not yet bound

I am using 1.24.1 version of vscode.

like image 357
Klark Avatar asked Aug 13 '18 16:08

Klark


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.

How do I debug Chrome in VS Code?

The new debugger can be used without having to install any extensions in three ways: Pressing F5 (Start Debugging) Activating the debug icon in the menu bar and selecting "Run and debug" Opening the Visual Studio Code command palette and running the "Debug: Open Link command"

How do you debug a breakpoint in Visual Studio code?

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.

Why is my debugger not working in VS Code?

Debugger not working Look at the debugger console for any error messages displayed. Look at the Debugger Tools console output for any errors. Remember to re-start VS Code once done (this won't be necessary in a future release). Solution: Clear all expressions from the debugger Watch window and start debugging again.


1 Answers

When using Visual Studio Code > Open Folder..., make sure you open the folder in which package.json is located.

like image 73
Phillip Ngan Avatar answered Oct 05 '22 22:10

Phillip Ngan