Here's what was going on! It has to do with the path to the project in the .vscode file and the need to debug two separate project/s folders at one time!

${workspaceFolder}

I have two folders for the app

  1. Yogabandy-SPA (Angular app)
  2. Yogabandy.API (ASP.Net Core Web API)

I thought the best place for the .vscode file was at the root level, and unless someone has a better solution this seems to be the best place.

But the problem is the path of the workspace folder needed to be corrected.

Corrected paths

"webRoot": "${workspaceFolder}" // old
"webRoot": "${workspaceFolder}/Yogabandy-SPA" // new
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/Yogabandy.API.dll" // old
"program": "${workspaceFolder}/Yogabandy.API/bin/Debug/netcoreapp2.2/Yogabandy.API.dll" // new

// removed from the 'server' command so two debuggers don't open, just one
"serverReadyAction": {
  "action": "openExternally",
  "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
},

Added a compound so that I could debug both projects together.

"compounds": [{
  "name": "Server/Client",
  "configurations": ["server", "client"]
}]

I'm still having a minor issue starting the debugger. VS Code displays this below, but I am able to now debug both apps together and hit all breakpoints from both projects.

If anyone has a better solution please let me know.

"compounds": [{
  "name": "Server/Client",
  "configurations": ["server", "client"]
}],
"configurations": [{
    "name": "server",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/Yogabandy.API/bin/Debug/netcoreapp2.2/Yogabandy.API.dll",
    "args": [],
    "cwd": "${workspaceFolder}/Yogabandy.API",
    "stopAtEntry": false,
    "env": {
      "ASPNETCORE_ENVIRONMENT": "Development"
    },
    "sourceFileMap": {
      "/Views": "${workspaceFolder}/Views"
    }
  },
  {
    "type": "chrome",
    "request": "launch",
    "name": "client",
    "url": "http://localhost:4200",
    "webRoot": "${workspaceFolder}/Yogabandy-SPA"
  }

Answer from chuckd on Stack Overflow
Top answer
1 of 10
27

Here's what was going on! It has to do with the path to the project in the .vscode file and the need to debug two separate project/s folders at one time!

${workspaceFolder}

I have two folders for the app

  1. Yogabandy-SPA (Angular app)
  2. Yogabandy.API (ASP.Net Core Web API)

I thought the best place for the .vscode file was at the root level, and unless someone has a better solution this seems to be the best place.

But the problem is the path of the workspace folder needed to be corrected.

Corrected paths

"webRoot": "${workspaceFolder}" // old
"webRoot": "${workspaceFolder}/Yogabandy-SPA" // new
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/Yogabandy.API.dll" // old
"program": "${workspaceFolder}/Yogabandy.API/bin/Debug/netcoreapp2.2/Yogabandy.API.dll" // new

// removed from the 'server' command so two debuggers don't open, just one
"serverReadyAction": {
  "action": "openExternally",
  "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
},

Added a compound so that I could debug both projects together.

"compounds": [{
  "name": "Server/Client",
  "configurations": ["server", "client"]
}]

I'm still having a minor issue starting the debugger. VS Code displays this below, but I am able to now debug both apps together and hit all breakpoints from both projects.

If anyone has a better solution please let me know.

"compounds": [{
  "name": "Server/Client",
  "configurations": ["server", "client"]
}],
"configurations": [{
    "name": "server",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/Yogabandy.API/bin/Debug/netcoreapp2.2/Yogabandy.API.dll",
    "args": [],
    "cwd": "${workspaceFolder}/Yogabandy.API",
    "stopAtEntry": false,
    "env": {
      "ASPNETCORE_ENVIRONMENT": "Development"
    },
    "sourceFileMap": {
      "/Views": "${workspaceFolder}/Views"
    }
  },
  {
    "type": "chrome",
    "request": "launch",
    "name": "client",
    "url": "http://localhost:4200",
    "webRoot": "${workspaceFolder}/Yogabandy-SPA"
  }

2 of 10
25

Just in case this was not helpful, I had the same problem, just because of wrong angular.json configuration

"development": {
    "buildOptimizer": false,
    "optimization": false,
    "vendorChunk": true,
    "extractLicenses": false,
    "sourceMap": true,
    "namedChunks": true
}

without this configuration, it's handled like production and You are not able to stop at breakpoints.

🌐
DaniWeb
daniweb.com › programming › web-development › threads › 539178 › debugging-and-breakpoint-not-working-for-angular-in-vs-code
Debugging and Breakpoint not working for Angular in VS Code
VS Code’s built‑in JS debugger supports Edge/Chrome out of the box; you do not need full Visual Studio for this scenario. Browser debugging in VS Code. If breakpoints stay unbound, check sourcemaps and project root: Open the workspace at ...
Discussions

Unbound breakpoints when debugging Angular in VSCode with Chrome
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug ... Can't debug Angular in VSCode. The breakpoints are unbound. More on github.com
🌐 github.com
1
August 5, 2023
Angular 18 Upgrade Vive causes VSCode Unbound Breakpoint issue
Which @angular/* package(s) are the source of the bug? upgrade Is this a regression? Yes Description Since upgrading my project from v17 to v18, I cannot bind debugger breakpoints from within VSCod... More on github.com
🌐 github.com
3
June 23, 2024
Cannot debug Angular 18 from VSCode
console.log('is4everKing') More on reddit.com
🌐 r/Angular2
8
5
August 17, 2024
Angular 7 Breakpoints are not hit
I am able to set break points in Chrome where the TS SourceMaps work as expected. Expected Results: Breakpoints should be hit in Visual Studio Code. More on github.com
🌐 github.com
6
June 6, 2019
🌐
GitHub
github.com › microsoft › vscode-js-debug › issues › 1778
Unbound breakpoints when debugging Angular in VSCode with Chrome · Issue #1778 · microsoft/vscode-js-debug
August 5, 2023 - Can't debug Angular in VSCode. The breakpoints are unbound. Steps to reproduce the behavior: Create basic angular app: ng new testProjectName Place breakpoint into app.component.ts (or anywhere else) Go to Run and Debug (Ctrl+Shirt+D) Cr...
Author   ktylhy
🌐
GitHub
github.com › angular › angular-cli › issues › 27909
Angular 18 Upgrade Vive causes VSCode Unbound Breakpoint issue · Issue #27909 · angular/angular-cli
June 23, 2024 - Which @angular/* package(s) are the source of the bug? upgrade Is this a regression? Yes Description Since upgrading my project from v17 to v18, I cannot bind debugger breakpoints from within VSCode. During the upgrade, I've chosen the o...
Author   godind
🌐
Reddit
reddit.com › r/angular2 › cannot debug angular 18 from vscode
r/Angular2 on Reddit: Cannot debug Angular 18 from VSCode
August 17, 2024 -

I create a new application using:

ng new debugtest1

I then open the new directory in VSCode. I can see the launch.json that was created by ng new, see this below.

I hit F5 to run and debug, and indeed the VSCode runs ng serve in its terminal, opens Chrome and runs the app. No problems so far.

The problem is, the VSCode debugger is extremely unreliable and unpredictable:

  1. Sometimes valid breakpoints are hit, sometimes not. I can tell they are not being hit because even simple console.log() breakpoints do nbnot pause the debugger, when I can see their output in the console!

  2. When the debugger does pause on a breakpoint, sometimes the "play" and "step over" buttons will work, sometimes they do nothing at all.

  3. The "Reload" button in the debug toolbar (next to "Stop" and "Play") does not do anything. It does not hot reload the app as you would expect.

  4. When I hit the "Stop" square button, the debug session stops but the ng serve terminal process started by the debugger does not terminate. I have to manually terminate the terminal process before I can start a new debugging session.

Effectively, debugging is not possible. In older versions of Angular and VSCode, I have debugged with no issues.

Can anyone advise on how to get even this simple debugginig working on VSCode?

The launch.json created by "ng new" in case it helps:

{
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "ng serve",
      "type": "chrome",
      "request": "launch",
      "preLaunchTask": "npm: start",
      "url": "http://localhost:4200/"
    },
    {
      "name": "ng test",
      "type": "chrome",
      "request": "launch",
      "preLaunchTask": "npm: test",
      "url": "http://localhost:9876/debug.html"
    }
  ]
}
🌐
GitHub
github.com › microsoft › vscode › issues › 74993
Angular 7 Breakpoints are not hit · Issue #74993 · microsoft/vscode
June 6, 2019 - I am able to set break points in Chrome where the TS SourceMaps work as expected. Expected Results: Breakpoints should be hit in Visual Studio Code.
Author   CieloVistaSoftware
Find elsewhere
🌐
GitHub
github.com › microsoft › vscode-js-debug › issues › 1766
Debugger not stopping at breakpoints · Issue #1766 · microsoft/vscode-js-debug
Describe the bug Debugger is not stopping at breakpoints. I am using a workspace with 3 Angular projects. To Reproduce Steps to reproduce the behavior: Just open some Typescript file , add a breakpoint and launch the debugger. Log File I...
Author   ghost
🌐
GitHub
github.com › microsoft › vscode › issues › 167353
Starting Angular with debugger fails · Issue #167353 · microsoft/vscode
November 28, 2022 - [webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled. WARNING: Processing source-maps of http://localhost:4200/vendor.js took longer than 999.4050689999995 ms so we continued execution without waiting for all the breakpoints for the script to be set. Angular is running in development mode.
Author   rajinder-yadav
🌐
Wordpress
ianvink.wordpress.com › 2020 › 03 › 09 › vscode-handling-debugging-error-breakpoint-set-but-not-yet-bound
#VSCode: Handling Debugging Error “Breakpoint set but not yet bound” | Asp.Net Core, Angular, Xamarin and Maui
August 15, 2020 - When you have multiple, it can cause issues with connecting a debugger. Here's the trick on how to handle that situation: After you create a new Angular app then try to debug it in VSCode, you can often get the ...
🌐
GitHub
github.com › Microsoft › vscode-recipes › issues › 81
Angular breakpoints not working as expected · Issue #81 · microsoft/vscode-recipes
March 1, 2018 - I'm using "@angular/cli": "~1.7.1" and "typescript": "~2.5.3", if that matters. I start with npm start. Click to add a breakpoint to Line 17, and that line shows up in the Debug view. All good so far. I press F5, Chrome opens. I click the button that triggers go().
🌐
GitHub
github.com › angular › angular-cli › issues › 17488
VSCode: Debug breakpoints not working for ng test · Issue #17488 · angular/angular-cli
April 16, 2020 - Breakpoints are not hit when debugging unit tests inside an angular workspace. > npx @angular/cli new applications --createApplication=false --strict=true ... { "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "Test", "url": "http://localhost:9876/debug.html", "webRoot": "${workspaceFolder}" } ] } Open applications folder in Visual Studio Code and add breakpoints to any test case inside projects/admin-console/src/app/app.component.spec.ts
Author   prabh-62
🌐
Developer Community
developercommunity.visualstudio.com › t › typescript-breakpoints-dont-work-with-angular-12 › 1489262
Typescript breakpoints dont work with Angular 12
July 28, 2021 - Skip to main content · Microsoft · Visual Studio · Sign in · You need to enable JavaScript to run this app · Sorry this browser is no longer supported · Please use any other modern browser like 'Microsoft Edge'
🌐
Developer Community
developercommunity.visualstudio.com › t › Cannot-debug-TypeScript-code-under-Stand › 10284847
Cannot debug TypeScript code under Standalone ...
Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions Subscriber Access
🌐
GitHub
github.com › microsoft › vscode › issues › 210717
Debugging ANGULAR project in VSCode not working. · Issue #210717 · microsoft/vscode
April 19, 2024 - Application starts and logged in successfuly, navigate to page where breakpoint will be hitted-> application hangs and nothing happens, neither the breakpoint is reached, after few minutes of wait the break point is reached and when press f10 or f5 this message appears: I have to then either reopen or close vscode which ends up everything. This is really frustrating as it hampers my daily development, this was working perfectly fine but from last few updates i am seeing this error. I have tried uninstalling and re installing vs code, also updated to version 1.87.2 but nothing worked.
Author   mayank594
🌐
GitHub
github.com › angular › angular-cli › issues › 15139
Why did the breakpoints in vs19 stop working after angular 8 update? · Issue #15139 · angular/angular-cli
July 21, 2019 - Summarization: I just updated my angular webproject yesterday from version 7.2.15 to 8.1.2 with the angular cli and the ng update command. But now if I try to debug my typescript code, all of a sudden the breakpoints won't work anymore in visual studio community 2019? So when I activate a breakpoint, then the breakpoint turns white and shows a label text that says something like: Breakpoint set but not yet bound.
Author   CreativeHouseDotOrg
🌐
GitHub
github.com › angular › angular-cli › issues › 24601
[BUG] - Cannot hit breakpoints with `ng serve` if Node 18 LTS is used · Issue #24601 · angular/angular-cli
January 24, 2023 - When using Node 18 (LTS), a newly created project cannot hit any breakpoints (greyed out). The debugger gets attached correctly, but in VSCode no breakpoints are active.
Author   Franiac