我对使用Visual Studio Code和带有C# Web API后端的Angular应用程序还比较新。在C#中没有问题,但在VS Code中的Angular应用程序中无法命中断点!
我可以通过终端用dotnet run
和 ng serve
在浏览器中运行这两个应用程序,但是当我按下调试按钮来调试我的应用程序时,Angular断点从红色变为空心灰色!
免责声明 - 我必须提到,我更改了很多文件名并重命名了.csproj文件,因为我想让应用程序反映我的姓名而不是教练使用的那个。在我这样做之前,我能够在Angular应用程序中设置断点并命中它们。
以下是我尝试过的方法:
- 重新启动VS Code
- ng start, ng serve
- 在包含我的两个项目文件夹(Ng,.Net)的同一级别的文件夹中生成新的launch.json文件(由VS Code自动生成)
- 删除我的工作区文件(似乎无法生成新文件,不确定是否需要)
在文件:
error.interceptor.ts
我正在尝试通过以下方式测试此异常处理:
throw new Exception("Some login error");
在我的登录方法中,我可以设置下面所示的断点,但是当我点击调试时,它会变成灰色圆圈并且永远不会被触发。这是我设置断点的地方
当我运行调试器时,红色的圆圈变成了灰色的空心圆圈。我想在调试时能够逐步跨越此错误拦截器,是否可能?
然后在我的Angular应用程序中的登录方法中,我的断点变成了灰色
这是我的launch.json文件:
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Yogabandy.API/bin/Debug/netcoreapp2.2/Yogabandy.API.dll",
"args": [],
"cwd": "${workspaceFolder}/Yogabandy.API",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
同时 - 当我运行调试控制台时看到很多这样的行。不知道这是否正常?
已加载 '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.4/System.Threading.dll'。模块是没有符号构建的。 已加载 '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.4/System.IO.FileSystem.Watcher.dll'。跳过加载符号。该模块已经过优化,并启用了调试器选项“仅我的代码”。