在Visual Studio Code

时间:2019-05-18 15:31:11

标签: macos visual-studio-code vscode-debugger

我只是在学习VS Code和Angular,我一直在关注在线教程并尝试调试。启动调试器后,它会从提供的下拉列表中询问我也要附加什么过程。

根据调试器,我应该在此处看到一个“ DatingApp.API.dll”过程,就像在本教程中那样,因为我将项目命名为与在教程中相同。

enter image description here

但是我在下面看到的没有.dll名称,只是-bash id

enter image description here

现在,当我在调试部分中选择.Net Core Attach而不是.Net Core Launch(web)选项时,就会得到此提示

enter image description here

当我选择.Net Core Launch(web)时,它会自动附加到应用程序中,但是我的问题是为什么我没有看到进程名称“ DatingApp.API.dll”,而是看到“ -bash 1730”代替?

'-bash 1730'是过程,因此我可以使用它进行连接,我很好奇为什么它不将其命名为'DatingApp.API.dll'?

这是我的launch.json文件

{
 "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}/DatingApp.API/bin/Debug/netcoreapp2.2/DatingApp.API.dll",
        "args": [],
        "cwd": "${workspaceFolder}/DatingApp.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}"
    }
]}

1 个答案:

答案 0 :(得分:1)

这有点棘手,如果您输入搜索DatingApp.API,它将向您显示DatingApp.API.exe作为唯一结果,或者至少是我尝试时得到的结果。您也可以附加它。

enter image description here

还有Voilá!现在,您可以调试C#应用了。

enter image description here