Martin Kjeldsen
Martin Kjeldsen

Reputation: 481

Failed to launch debug adapter in Visual Studio 2022

If I create an ASP Core MVC (Target Framework 5.0) with Docker support enabled and start it I get:

"One or more errors occurred. Failed to launch debug adapter. Additional information may available in the output window. The operation was cancelled."

This is the debug output:

enter image description here

Enabling DebugAdapterHost.Logging with

DebugAdapterHost.Logging /On /OutputWindow

Gives the following output:

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.

I have tried re-installing Docker Desktop and Visual Studio 2022. Windows 11 is fully updated.

I can build and run an Nginx image directly in Docker Desktop without errors so I think it has something to do with my Visual Studio 2022 install.

My setup:

Docker Desktop 4.5.1

Microsoft Visual Studio Community 2022 (64-bit) - 17.1.0

Windows 11 Home

I also tried downgrading to:

Docker Desktop 4.4.4

Microsoft Visual Studio Community 2019 (64-bit)

But with exactly the same result.

Upvotes: 18

Views: 33684

Answers (9)

Peter Morris
Peter Morris

Reputation: 23224

For me I had to remove the following line from Properties\launchSettings.json

"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",

Upvotes: 0

Bardhyl Begolli
Bardhyl Begolli

Reputation: 1

The solution that worked for me: Visual Studio 2022, Docker

  • Closing all Visual Studio instances
  • delete ".vs/" folder inside project folder
  • cleaning the solution after re-open the solution

Upvotes: 0

LeoL
LeoL

Reputation: 93

If none of the previous answers work, it may be a VisualStudio version problem. If at some point your visual studio started giving you this error try downgrading to the previous version. In my case Visual Studio had upgraded to version 17.10.1. Searching on the net someone else had the same problems as me which apparently is caused by a bug in that version. By downgrading to version 17.8.10 I was able to solve it.

Upvotes: 1

devbf
devbf

Reputation: 561

Like mentioned in this answer, closing all instances of Edge in the windows task manager solved the problem for me (having a Blazor WebAssembly application in VS 2022).

I had to filter for Edge, as there have been some "hidden" instances left in the background processes part of the task manager.

Upvotes: 1

Martin Kjeldsen
Martin Kjeldsen

Reputation: 481

It turns out that "/remote_debugger/vsdbg" is indeed missing. It is expected to be found in "C:\Users\username\vsdbg\vs2017u5" on the host.

Deleting the whole directory ("C:\Users\username\vsdbg\vs2017u5") and then pressing F5 forces Visual Studio to re-create the directory and debugging now works.

Upvotes: 27

Zac
Zac

Reputation: 86

I was getting the same error message box when trying to use python. For me, enabling native code debugging in the Debug Properties window fixed the issue. You can find Debug Properties under the Debug menu item.

I also had to download debugging symbols: Microsoft has documentation on how to do so here but the quick run-down is to re-run the python installer, click modify, select both box checkboxes regarding debug symbols, and click Next/Install. Now everything works for me again.

Enable native code debug checkbox

Upvotes: 6

PDoria
PDoria

Reputation: 572

In my case I did a Clean & Rebuild for the project. After this I closed an opened instance of the browser that I used previously to test.

After this I ran the project and a new instance of the browser opened for testing as usual.

Upvotes: 2

Umair Ijaz
Umair Ijaz

Reputation: 209

For me this worked out:

  1. clean and rebuild the solution.
  2. Disable script debugging in Visual Studio, in the drop-down of green arrow, from where we run the project.

Screenshot for step 2

Upvotes: 10

Vivek Budithi
Vivek Budithi

Reputation: 622

I got the exact same error "The terminal process terminated with exit code: 4294967295"

Tried some of the ways

  • Clean/Rebuild

  • Restarted the Visual Studio.

  • Deleting the directory (which was mentioned above)

  • Changed the settings (tools -> options-> Debugging -> General ->enabling the "enable JavaScript debugging" and "multi-target JavaScript debugger"

I tried some of these links

TheWindowsclub

VSCodeIssues

Finally the problem solved by restarting my PC.

Upvotes: 2

Related Questions