Visual Studio代码Ubuntuaspnet core 2容器调试

Visual Studio Code Ubuntu aspnet core 2 container debugging

我用谷歌搜索并查看了 Whosebug,但找不到解决方案。

设置:

主持人OS:Ubuntu

ASPNet 核心 2

网络 2.0


我有两个容器,一个用于 MySQL,另一个用于 dotnet 核心。我能够 运行 它而无需安装 CLR 调试器。在一个容器中安装 CLR 调试器后,我尝试使用 Visual Studio 代码在该容器中调试 aspnet core 2 应用程序 运行ning。我收到以下错误:

"The pipe program 'bash' exited unexpectedly."

唯一的选项是 "open Launch.json",launch.json 中只有 bash 命令是:

        "pipeTransport": {            
            "pipeProgram": "/bin/bash",            
            "pipeCwd": "${workspaceRoot}",            
            "pipeArgs": ["-c",            
                "docker exec -i devexamapp_debug_1 /clrdbg/clrdbg --interpreter=mi"],
            "debuggerPath": "/vsdbg/vsdbg"

调试控制台显示如下:

开始:“/bin/bash”-c "docker exec -i devexamapp_debug_1 /clrdbg/clrdbg --interpreter=mi"“/vsdbg/vsdbg --interpreter=vscode”

如果我在控制台中 运行 "/bin/bash" -c "docker exec -i devexamapp_debug_1 /clrdbg/clrdbg --interpreter=mi" "/vsdbg/vsdbg --interpreter=vscode" window然后它可以 100% 正常工作,没有任何错误。

我错过了什么?有帮助吗?

谢谢

编辑 1:10 月 14 日

您需要在 Docker 映像中安装调试器。您可以通过将以下内容添加到您的 dockerfile

来执行相同的操作
WORKDIR /vsdbg 
RUN curl -SL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg

然后您需要更新 launch.json 中的 pipeTransport 如下

"pipeTransport": { 
   "pipeProgram": "docker", 
   "pipeCwd": "${workspaceRoot}", 
   "pipeArgs": ["exec -i devexamapp_debug_1"], 
   "debuggerPath": "/vsdbg/vsdbg", 
   "quoteArgs": false 
}