Repository navigation
fix(wslc): clarify WSL runtime prerequisite - #656
Conversation
|
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
| } | ||
|
|
||
| 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 <[email protected]> Copilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
- Branch remediation guidance by missing component: VirtualMachinePlatform now tells the user to enable the Windows optional feature instead of incorrectly suggesting a WSL update, per review feedback (updating WSL does not enable Virtual Machine Platform). - Standardize on 'WSLC runtime unavailable' wording across code and docs (was inconsistent with 'runtime not available' in some places). - Add table-driven tests covering WslPackage, VirtualMachinePlatform, their combined value, and SdkNeedsUpdate, asserting the version and remediation guidance selected for each case. - Align remaining docs mentions in wsl-container-support-plan.md with the same wording. Co-authored-by: Copilot App <[email protected]>
e0681ed to
a30461e
Compare
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (4)
src/backends/wslc/common/src/wsl_container_runner.rs:343
WSLC_COMPONENT_FLAG_SDK_NEEDS_UPDATEis not handled here. When it is the only bit, the message merely says to ensure the SDK is installed; when combined with another bit, SDK guidance disappears entirely. Add a dedicated branch with an actionable SDK-update remedy, leaving the generic fallback only for unknown flags.
if guidance.is_empty() {
guidance.push("ensure WSL2 and the WSLC SDK are installed".to_string());
docs/wsl/wsl-container-getting-started.md:303
- This troubleshooting row omits the
SdkNeedsUpdatecondition thatWslcGetMissingComponentscan report. Add the outdated/incompatible WSLC SDK case and its actionable remedy; otherwise users receiving that named component still cannot resolve the error from this guide.
| `WSLC runtime unavailable` | WSL runtime package is missing, older than 2.9.3, or the Virtual Machine Platform optional component is disabled | Update WSL with `wsl --update --pre-release`, verify the installed version with `wsl --version`, and enable the Virtual Machine Platform optional component if required. The WSLC SDK DLL is a separate dependency and does not replace the WSL runtime package. |
docs/wsl/wsl-container-getting-started.md:14
- This newly added row duplicates the identical Windows 11 prerequisite immediately above it. Remove the duplicate so the table lists each requirement once.
This issue also appears on line 303 of the same file.
| **Windows 11** | Required for WSL2 and the WSLC SDK |
src/backends/wslc/common/src/wsl_container_runner.rs:340
- This contradicts the PR description, which says the error should direct users to WSL 2.8.1+ and the stable
wsl --updatecommand. Requiring 2.9.3 from the pre-release channel is materially different. Confirm the actual runtime floor and align this message, its tests, the getting-started guide, and the PR description.
This issue also appears on line 342 of the same file.
.push("install WSL 2.9.3 or newer and run `wsl --update --pre-release`".to_string());
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Medium
Two conflicts, both resolved by keeping each side's intent: * src/backends/wslc/common/src/wsl_container_runner.rs -- both sides appended to `mod tests`, so both blocks are kept: this branch's teardown/pump tests and main's `wslc_prerequisite_error` tests (microsoft#656). * docs/wsl/wsl-container-getting-started.md -- takes main's clarified WSL runtime and WSLC SDK prerequisite wording, with this branch's note that the DLL sits next to *the running executable* (which is now the caller's own binary when using the Rust SDK), not only wxc-exec.exe. One deliberate deviation in that table: microsoft#656 landed the `Windows 11` row twice, and the merge offered to bring the duplicate along. The resolution keeps a single row -- adjacent identical rows are plainly accidental, and restating one here would make it look intentional. Flagging it since it is technically an upstream line this merge does not reproduce. Co-authored-by: Copilot <[email protected]> Copilot-Session: 1cfac031-7051-4559-8c4e-9f76fa8605c2 Signed-off-by: Carlos Alexandro Becker <[email protected]>
📖 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