fix(wslc): clarify WSL runtime prerequisite#656
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR clarifies WSLC prerequisite failures when WslcCanRun reports missing components, aligning runtime requirements (WSL runtime package minimum) with the getting-started documentation and adding a regression test for the new message.
Changes:
- Add a helper to produce a more specific WSLC prerequisite error when
WslcCanRunreportsWslPackagemissing, and add a unit test covering the message contents. - Update the WSLC getting-started guide to consistently document the minimum WSL runtime version (2.8.0+) and clarify that
wslcsdk.dllis a separate dependency.
Show a summary per file
| File | Description |
|---|---|
| src/backends/wslc/common/src/wsl_container_runner.rs | Improves prerequisite failure messaging from WslcCanRun and adds a unit test for the updated message. |
| docs/wsl/wsl-container-getting-started.md | Updates prerequisite and troubleshooting documentation to consistently state the WSLC minimum WSL runtime version and separate SDK DLL requirement. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Low
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
| } | ||
|
|
||
| fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String { | ||
| if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 { |
There was a problem hiding this comment.
WslcComponentFlags is a fieldless repr(u32) enum, but wslcsdk.h declares it as combinable flags. WslcCanRun can therefore return 3 when both components are missing, which is not a valid Rust enum discriminant and causes undefined behavior when read here. Please represent this FFI type as a transparent integer-backed bitmask and add coverage for combined values.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
| | `WSLC backend not compiled` | Binary built without `--features wslc` | Rebuild with `build.bat --with-wslc` | | ||
| | `Failed to load wslcsdk.dll` | DLL not in same directory as `wxc-exec.exe` | Copy `wslcsdk.dll` next to the binary | | ||
| | `WSLC runtime not available` | WSL version too old or missing components | Update WSL with `wsl --update` or build from the [WSL repo](https://github.com/microsoft/WSL/tree/feature/wsl-for-apps) | | ||
| | `WSLC runtime not available` | WSL is too old or missing components | Update WSL with `wsl --update` and verify the version with `wsl --version` | |
There was a problem hiding this comment.
This troubleshooting row keys on "WSLC runtime not available", but the runner now emits "WSLC runtime unavailable" (src/backends/wslc/common/src/wsl_container_runner.rs:360). Since aligning the message and the docs is the whole point of this PR, this row now points at a string the code no longer produces, so a user who copies the actual error and searches the guide won't find it. Please change the row key to "WSLC runtime unavailable" so it matches the emitted text verbatim.
While you're standardizing on the new wording, the design doc docs/wsl/wsl-container-support-plan.md (lines 239 and 278) still describes this condition as "WSLC runtime is not available". It's outside this PR's diff and only an internal planning doc, so it's low priority, but updating it in the same pass would keep the terminology consistent across the repo.
| return Err(ScriptResponse::error(&format!( | ||
| "WSLC runtime not available. Missing components: {:?}. \ | ||
| Ensure WSL2 and the WSLC SDK are installed.", | ||
| "WSLC runtime unavailable. Missing components: {:?}. Install WSL 2.8.1 or \ |
There was a problem hiding this comment.
The remedy here is "Install WSL 2.8.1 or newer and run wsl --update", but WslcCanRun can report VirtualMachinePlatform as missing, and updating the WSL package does not enable that Windows optional feature. A user who already has current WSL but no Virtual Machine Platform will run wsl --update, get the same failure, and have no path forward. Consider branching the guidance on the missing flag: keep the WSL version/update advice for the WslPackage case, and for the VirtualMachinePlatform case tell the user to enable that Windows feature (e.g. via Optional Features / DISM). The missing components are already available in the "missing" value, so the message can be specific about which one failed.
📖 Description
Clarifies the WSLC error when WSL is too old. The error now points users to WSL 2.8.1+ and
wsl --update; the getting-started guide is aligned.🔗 References
Resolves #553
🔍 Validation
cargo fmt --all -- --checkcargo test -p wslc_common(45 passed)✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes📋 Issue Type