Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2019 unable to debug .net core in WSL2

I have VS 2019 community ver 16.9.4. I've done the following:

  • Installed .NET Core Debugging with WSL 2 - 1.0.
  • Created a simple hello world C# console app in both .net core 3.1 and 5.0
  • Choose WSL2 in debug options and start debug

I'm getting the following error message:

One or more errors occurred.

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

The operation was canceled.

My output window says:

The program '' has exited with code -1 (0xffffffff).

I can confirm that I installed sdk in WSL2 ubuntu 20.04:

> dotnet --list-sdks
3.1.408 [/usr/share/dotnet/sdk]
5.0.202 [/usr/share/dotnet/sdk]

Any ideas?

like image 727
sheepinwild Avatar asked Nov 16 '25 01:11

sheepinwild


1 Answers

You need to install vsdbg in WSL. Run this command in WSL.

curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg
like image 142
BDisp Avatar answered Nov 17 '25 20:11

BDisp