【问题标题】:Failed to launch debug adapter in Visual Studio 2022无法在 Visual Studio 2022 中启动调试适配器
【发布时间】:2022-06-28 01:23:59
【问题描述】:

如果我创建一个启用了 Docker 支持的 ASP Core MVC(Target Framework 5.0)并启动它,我会得到:

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

这是调试输出:

使用 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 Desktop 和 Visual Studio 2022。Windows 11 已完全更新。

我可以直接在 Docker Desktop 中构建和运行 Nginx 映像而不会出错,因此我认为这与我的 Visual Studio 2022 安装有关。

我的设置:

Docker 桌面 4.5.1

Microsoft Visual Studio 社区 2022(64 位)- 17.1.0

Windows 11 家庭版

我也尝试降级到:

Docker 桌面 4.4.4

Microsoft Visual Studio 社区 2019(64 位)

但结果完全相同。

【问题讨论】:

  • 检查您的 Windows 事件日志以获取更具体的错误消息。
  • Windows 事件日志中没有错误
  • 我现在已经尝试启用来自 DebugAdapterHost 的日志输出,正如我在 SO 帖子中所描述的那样:stackoverflow.com/questions/69208007/… 我已将输出添加到原始帖子中。

标签: .net docker asp.net-core visual-studio-2022 docker-desktop


【解决方案1】:

原来 /remote_debugger/vsdbg 确实不见了。预计在主机上的C:\Users\username\vsdbg\vs2017u5中找到。

删除整个目录 (C:\Users\username\vsdbg\vs2017u5),然后按 F5 会强制 Visual Studio 重新创建目录,现在可以调试了。

【讨论】:

  • 搜索了一整天救了我,谢谢分享这个经验。
【解决方案2】:

对我来说,这解决了:

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

【讨论】:

    【解决方案3】:

    我得到了完全相同的错误“终端进程以退出代码终止:4294967295”

    尝试了一些方法

    • 清理/重建

    • 重新启动 Visual Studio。

    • 删除目录(上面提到过)

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

    我尝试了其中的一些链接

    TheWindowsclub

    VSCodeIssues

    终于重启我的电脑解决了问题。

    【讨论】:

      猜你喜欢
      • 2022-10-18
      • 2020-03-05
      • 1970-01-01
      • 2022-06-13
      • 2022-01-19
      • 2022-06-28
      • 2022-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多