我正在尝试调试一个运行在 Linux 容器中的 C#/.NET 6.0 控制台应用程序,该应用程序由 Visual Studio 2019 (版本 16.11.10) 运行。当我使用“调试/附加到进程…”连接到我的运行容器并附加到我的进程时,会出现错误:
“无法启动调试适配器。其他信息可能可在输出窗口中获得。”
“无法在 '/home/dockeruser/.vs-debugger' 找到调试器脚本。”
出于公司安全目的,我将我的容器工作负载作为用户dockeruser运行,但是当我将我的 Dockerfile 调整为以 root 用户身份运行时,我也可以重现此问题。错误消息变为:
“无法在 '/root/.vs-debugger' 找到调试器脚本。”
输出显示:
我可以通过在容器上执行docker exec命令,打开bash会话并按照https://dev59.com/bLnoa4cB1Zd3GeqPSIZS#68950674中的详细说明运行GetDbgVs.sh来解决此问题,但这样做很麻烦 - 感觉好像有什么配置错误。
我已经验证过我的Windows身份是Windows docker-users组的成员。
“无法启动调试适配器。其他信息可能可在输出窗口中获得。”
“无法在 '/home/dockeruser/.vs-debugger' 找到调试器脚本。”
出于公司安全目的,我将我的容器工作负载作为用户dockeruser运行,但是当我将我的 Dockerfile 调整为以 root 用户身份运行时,我也可以重现此问题。错误消息变为:
“无法在 '/root/.vs-debugger' 找到调试器脚本。”
输出显示:
Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
Initialization log:
Determining user folder on remote system...
Checking for existing installation of debugging tools...
Downloading debugger launcher...
Creating debugger installation folder: /home/dockeruser/.vs-debugger
Copying debugger launcher to /home/dockeruser/.vs-debugger/GetVsDbg.sh
Failed: Failed to copy files.
Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
Failed: Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
The program '[1] dotnet' has exited with code -1 (0xffffffff).
我可以通过在容器上执行docker exec命令,打开bash会话并按照https://dev59.com/bLnoa4cB1Zd3GeqPSIZS#68950674中的详细说明运行GetDbgVs.sh来解决此问题,但这样做很麻烦 - 感觉好像有什么配置错误。
我已经验证过我的Windows身份是Windows docker-users组的成员。