没有为该文档加载任何符号。无法在 Visual Studio 代码中调试 Javascript
No symbols have been loaded for this document. Can't debug Javascript in Visual Studio Code
我正在开发一个有 C# 后端但前端在 React 中的项目并且 Javascript。调试 C# 工作正常。当我尝试调试 Javascript 时,它显示 'No symbols have been loaded for this document'。请注意,这是 Visual Studio 代码 而不是 Visual Studio.
这是一个巨大的项目,所以我想在 Visual Studio 代码而不是 Chrome 工具中放置断点和调试代码。
我安装了 'Debugger for Chrome' VS 代码扩展,然后我将 launch.json 设置为:
{
"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"
}
}
}
]
}
首先,我使用 Launch WebApp(控制台)配置进行调试:
启动后,我 运行 'WebApp Chrome Debug' 配置相同:
调试中:
我正在开发一个有 C# 后端但前端在 React 中的项目并且 Javascript。调试 C# 工作正常。当我尝试调试 Javascript 时,它显示 'No symbols have been loaded for this document'。请注意,这是 Visual Studio 代码 而不是 Visual Studio.
这是一个巨大的项目,所以我想在 Visual Studio 代码而不是 Chrome 工具中放置断点和调试代码。
我安装了 'Debugger for Chrome' VS 代码扩展,然后我将 launch.json 设置为:
{
"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"
}
}
}
]
}
首先,我使用 Launch WebApp(控制台)配置进行调试:
启动后,我 运行 'WebApp Chrome Debug' 配置相同:
调试中: