Search code examples
.net-corewindows-subsystem-for-linuxwsl-2asp.net-core-6.0

Unable to debug WSL2 with VS 2022 - invalid 'cwd' value


I am trying to debug from WSL2 using my VS 2022 IDE in Windows, but I get the following error:

Invalid cwd value

The cwd value does indeed look wrong, but how do I fix it?

I am using .netcore 6.0.101, Ubuntu 20.04.3 and Windows 11.

launchSettings.json:

{
  "profiles": {
    "WSL": {
      "commandName": "WSL2",
      "launchBrowser": false,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "local"
      },
      "applicationUrl": "https://localhost:56962;http://localhost:56963", 
      "distributionName": "Ubuntu"
    }
  }
}
PS C:\Users\me> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop         Running         2
  docker-desktop-data    Running         2

Solution

  • This has been fixed in 17.4 Preview 5. The latest Preview releases are available for download here.