在Visual Studio 2022中无法启动调试适配器

11

如果我创建了一个启用Docker支持的ASP Core MVC(目标框架5.0),并启动它,我会得到以下错误提示:

"发生了一个或多个错误。无法启动调试适配器。其他信息可能在输出窗口中提供。操作已取消。"

这是调试输出:

enter image description here

启用DebugAdapterHost.Logging并附加以下参数:

DebugAdapterHost.Logging /On /OutputWindow

给出以下输出:
1> DebugAdapterHost version: 16.9.50429.2 commit:ca34bde2a8dfef71e1d0b3bafd2804978bfbe6a9
 1> Starting 'docker' with arguments 'exec -i 7ce0da2e24860812b487ef583433deee7b411229b69c5631dc73027fd0864f1f /bin/sh -c "ID=.; if [ -e /etc/os-release ]; then . /etc/os-release; fi; if [ $ID = alpine ] && [ -e /remote_debugger/linux-musl-x64/vsdbg ]; then VSDBGPATH=/remote_debugger/linux-musl-x64; else VSDBGPATH=/remote_debugger; fi; $VSDBGPATH/vsdbg --interpreter=vscode"'
 1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"coreclr","locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true},"seq":1}
 1> ERROR: Debug adapter error output: /bin/sh: 1: /remote_debugger/vsdbg: not found
 1> ERROR: Debug Adapter did not respond to initial requests.
 1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

Aggregate exception: 
    DebugAdapterLaunchException: Failed to launch debug adapter.  Additional information may be available in the output window.

    Failure Location: UserCanceled
    Inner Exception: 
        OperationCanceledException: The operation was canceled.
Inner Exception: 
    DebugAdapterLaunchException: Failed to launch debug adapter.  Additional information may be available in the output window.

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.DebuggedProcess.<StartDebugAdapter>b__114_3(Exception ex)
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>c__DisplayClass11_0`1.<Catch>b__0(TException ex)
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>c__DisplayClass10_0`1.<Catch>b__0(AggregateException ex)

    Failure Location: UserCanceled
    Inner Exception: 
        OperationCanceledException: The operation was canceled.

 1> Debug adapter process exited.
 1> ERROR: One or more errors occurred.

Failed to launch debug adapter.  Additional information may be available in the output window.

The operation was canceled.

我已经尝试重新安装Docker桌面版和Visual Studio 2022,同时Windows 11已经完全更新。

我可以直接在Docker桌面版中构建和运行Nginx镜像而不出现错误,因此我认为问题与我的Visual Studio 2022安装有关。

我的配置:

Docker桌面版4.5.1

Microsoft Visual Studio Community 2022(64位)- 17.1.0

Windows 11 Home

我还尝试了降级到以下版本:

Docker桌面版4.4.4

Microsoft Visual Studio Community 2019(64位)

但结果完全相同。


请检查您的Windows事件日志以获取更具体的错误消息。 - Troy Turley
Windows事件日志中没有错误。 - Martin Kjeldsen
我现在尝试启用从DebugAdapterHost输出日志,正如一个与我的问题非常相似的SO帖子所描述的那样:https://stackoverflow.com/questions/69208007/remote-debugger-vsdbg-not-found-and-failed-to-launch-debug-adapter-with-do 我已将输出添加到原始帖子中。 - Martin Kjeldsen
5个回答

22
原来"/remote_debugger/vsdbg"确实丢失了。它应该在主机的"C:\Users\username\vsdbg\vs2017u5"中找到。
删除整个目录("C:\Users\username\vsdbg\vs2017u5"),然后按F5键强制Visual Studio重新创建目录,现在调试正常工作。

5
搜了一整天终于救了我,感谢分享这个经历。 - Mohamed Mohsen

10

对我来说这个方法有效:

  1. 清理并重新构建解决方案。
  2. 在Visual Studio中禁用 脚本调试,在我们运行项目的绿色箭头下拉菜单中。

步骤2的截图


3
当我尝试使用Python时,也遇到了相同的错误提示框。对我来说,在Debug Properties窗口中启用本地代码调试解决了这个问题。您可以在Debug菜单项下找到Debug Properties。
我还需要下载调试符号:Microsoft有关于如何执行此操作的文档,点击此处,但简要概括一下就是重新运行Python安装程序,点击修改,选择与调试符号相关的两个复选框,然后点击下一步/安装即可。现在一切都正常工作了。 Enable native code debug checkbox 这里是启用本地代码调试复选框。

2

我遇到了完全相同的错误 "The terminal process terminated with exit code: 4294967295"

尝试了以下方法:

  • 清理/重建

  • 重新启动Visual Studio。

  • 删除目录(如上所述)

  • 更改设置(工具->选项->调试->常规->启用"启用JavaScript调试"和"多目标JavaScript调试器")

我尝试了以下链接:

TheWindowsclub

VSCodeIssues

最终问题通过重新启动我的电脑解决。


1
在我的情况下,我对该项目进行了清理和重建。之后,我关闭了之前用于测试的浏览器实例并重新打开了它。
然后,我运行了该项目,一个新的浏览器实例像往常一样打开以进行测试。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接