2

For a few weeks now I have had this very strange issue and have been unable to resolve it:

I usually code on WSL2, and it used to work fine on this machine and user. But now, whenever I try to open the Remote Explorer in Visual Studio Code or try to open a "New Project from Existing Files" in an IntelliJ IDE, no WSL Distros show up.

They are still there - wsl -l -v lists them and I can open them in the terminal. Everything inside of them works (aside from opening VSCode).

In Windows Explorer, their filesystems do show up. But in Visual Studio Code the list of Distros is empty and I get an error message stating "Cannot read properties of undefined (reading 'name')" when I open the Remote Explorer. In IntelliJ IDEs, only my local drives appear where there used to be additional entries for WSL.

When I navigate to a directory in WSL in the terminal and then execute code ., it opens a VSCode window, but then I get the notification "No WSL distros found".

Interestingly, previously opened projects in IntelliJ IDEs can still be opened (but I am getting Line-Ending issues).

I have tried reinstalling the WSL extension in VSCode, restarting the LXSSManager-Service, doing a network reset with netsh winsock reset, netsh int ip reset, ipconfig /release, ipconfig /renew, ipconfig /flushdns - and I have tried reinstalling VSCode entirely... to no avail. I have also looked at the registry entries for the WSL Distros under Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\, and they look fine to me.

I have also uninstalled my non-primary distros and reinstalled them - same issue across all installed distros, old or freshly installed.

I am sadly unable to specify how to reproduce the issue as everything used to work in this setup and nothing was deliberately changed.

My Windows version is Windows 11 Version 22H2 (OS Build 22621.963).

LazyOne
  • 158,824
  • 45
  • 388
  • 391
MBauerDC
  • 160
  • 8

1 Answers1

0

TLDR: try running setx WSL_UTF8 0 in cmd.exe and restart VS Code

I also had the same No WSL distros found issue suddenly in VS Code 1.81.1 and the previous version.

enter image description here

It worked fine last week with my projects in Ubuntu 16.04. I tried similar installing of new distros and the WSL extension and VS Code, but nothing made any difference.

What changed is that the WSL debug terminal name was mangled:

enter image description here

The code at https://github.com/microsoft/vscode-remote-release/issues/3910#issuecomment-722269579, returns blank but requires UTF16 from wsl -l, so VS Code is not yet compatible with the new WSL_UTF8 environment variable.

An example of a safe way of using the WSL_UTF8 option in a batch script is found at https://stackoverflow.com/a/76970840/1919793

theSparky
  • 440
  • 3
  • 13