Skip to content

Launch Windows diff tools from inside WSL - #949

Merged
SimonCropp merged 4 commits into
mainfrom
wsl-windows-tools
Oct 10, 2026
Merged

SimonCropp merged 4 commits into
mainfrom
wsl-windows-tools

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Stacked on #947, which stops WSL counting as a build server. Without that, nothing is launched inside WSL at all.

Inside a WSL distribution, a tool with no copy in the distribution is now resolved from its Windows definition and started through WSL's interop. Both files are passed as Windows paths: C:\... on a mounted drive, \wsl.localhost\<distro>\... otherwise.

How

  • Resolution (OsSettingsResolver, WslHost): the Linux definition first, then the Windows one. The host's variables come from one cmd.exe /u /c set, its drives from /proc/mounts, the share name from one wslpath -w /. A program on the PATH is found from one listing of each host directory, since a stat on a Windows drive from inside WSL is most of a millisecond.
  • Paths (WslPaths): translated in process.
  • Launch (WslInterop.Start): all three streams redirected and closed, so the tool does not hold the pipe dotnet test reads.
  • Tracking: ps lists such a tool as /init <exe> <exe> <args>, which StripProxy brings back to the command it was started with.

Behaviour to know

  • A Windows tool is never closed from WSL: not when its test passes, and a tool that does not auto refresh gets a second window on a repeat failure. Ending the Linux-side process does not close a windowed tool.
  • Tool order now reaches Windows tools, so Beyond Compare opens ahead of VS Code where both are installed, as on Windows.
  • Not offered: the viewer, a tool whose Windows executable is a .cmd, and Vim and Neovim.
  • DiffEngine_WslWindowsTools=false turns it off.
  • Tool resolution under WSL went from about 0.24 s to 0.42 s per test process on the machine it was measured on.

Testing

  • 63 new tests, which need no WSL: a temp directory stands in for the drive. They pass on .NET 10 and .NET Framework 4.8 on Windows, and inside an Ubuntu distribution.
  • By hand in Ubuntu under WSL 2: a failing Verify test opened Beyond Compare, WinMerge and P4Merge with the right files, a second failing run found the open Beyond Compare window, and the run returned with the window still open.
  • Not tested: Rider, Guiffy, Diffinity and the Word and Excel comparers (they resolve but were not launched), WSL 1, mirrored networking, and a distribution with the Windows PATH not appended.

A tool with no copy in the distribution is resolved from its Windows definition and started through WSL's interop, with both files passed as Windows paths. Such a tool is found again by its command line and is never killed from here, since the process this side holds is WSL's stand-in for it. DiffEngine_WslWindowsTools=false turns it off.
@SimonCropp SimonCropp added this to the 20.8.0 milestone Oct 10, 2026
Base automatically changed from wsl-not-build-server to main October 10, 2026 02:08
# Conflicts:
#	readme.md
#	readme.source.md
@SimonCropp
SimonCropp merged commit c83fd33 into main Oct 10, 2026
8 checks passed
@SimonCropp
SimonCropp deleted the wsl-windows-tools branch October 10, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant