We are developing an angular application that up until a few days ago, we would hit F5 from VSCode, the angular application would be built, Chrome would be launched, and we would be able to debug our code inside VSCode no problem.
Our launch.json file looks like this:
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "chrome",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
]
And our tasks.json file looks like this:
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "Compiled successfully."
}
}
}
}
]
}
The application builds just fine, no errors, and a browser is launched, we can see the title of the web page, but it is stuck loading. I can't right click view source. I don't see any network traffic.
The weird thing, though, is that I can control click the link at the end of the terminal and launch the application just fine:
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
So I know the entire application is working just fine, it is just this startup attachment process that isn't working anymore. We haven't changed these files in a long time so I'm wondering if anyone else is running into not being able to launch / debug with a single F5 from VSCode.
I was able to resolve it by deleting the workspaceStorage folder in e.g.
C:\Users<YOURUSERNAME>\AppData\Roaming\Code\User\workspaceStorage.
Alternatively you can find the specific workspace folder and delete the state.vscdb and state.vscdb.backup files. Below is how to find the containing folder in windows / powershell
(sls -Path "$env:APPDATA/Code/User/WorkspaceStorage/*/workspace.json" <FOLDERNAME>).Path
Probably there is a better way to fix it. Workspace storage folders contain extension state, etc. I would guess some state went bad or something.