Gail Foad
Gail Foad

Reputation: 720

No symbols have been loaded for this document. Can't debug Javascript in Visual Studio Code

I'm working on a project that has a C# backend but the frontend is in React and Javascript. Debugging the C# works fine. When I try to debug the Javascript, it says 'No symbols have been loaded for this document'. Note that this is in Visual Studio Code not Visual Studio.

It's a huge project, so I'd like to place breakpoints and debug the code in Visual Studio Code rather than in Chrome tools.

enter image description here

Upvotes: 3

Views: 3145

Answers (1)

Gail Foad
Gail Foad

Reputation: 720

I installed the 'Debugger for Chrome' VS Code extension, then I set my launch.json to be this:

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "WebApp Chrome Debug",
        "type": "chrome",
        "request": "launch",
        "url": "http://localhost:5000",
        "webRoot": "${workspaceFolder}/Bob/WebApp",
        "sourceMapPathOverrides": {
            "/*": "/__vscode-remote-uri__/*",
        }
    },
    {
        "name": "Launch WebApp (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceFolder}/Bob/WebApp/bin/Debug/WebApp.dll",
        "args": [],
        "cwd": "${workspaceFolder}/Bob/WebApp",
        "console": "externalTerminal",
        "internalConsoleOptions": "openOnSessionStart",
        "stopAtEntry": false,
        "launchBrowser": {
            "enabled": true,
            "args": "${auto-detect-url}",
            "windows": {
                "command": "cmd.exe",
                "args": "/C start ${auto-detect-url}"
            },
            "osx": {
                "command": "open"
            },
            "linux": {
                "command": "xdg-open"
            }
        }
    }
    ]
}

First I debug using the Launch WebApp (console) configuration:

Launch WebApp (console)

Once that's launched, I run the 'WebApp Chrome Debug' configuration the same way:

Webapp Chrome Debug

Debugging:

debugging

Upvotes: 1

Related Questions