Skip to content

fix(wslc): clarify WSL runtime prerequisite#656

Open
huzaifa-d wants to merge 2 commits into
mainfrom
huzaifa-d-investigate-issue-553
Open

fix(wslc): clarify WSL runtime prerequisite#656
huzaifa-d wants to merge 2 commits into
mainfrom
huzaifa-d-investigate-issue-553

Conversation

@huzaifa-d

@huzaifa-d huzaifa-d commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

📖 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 -- --check
  • cargo test -p wslc_common (45 passed)

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • Updated documentation (if applicable)
  • Updated Copilot instructions (if build, architecture, or conventions changed)
  • If this PR changes Cargo.lock, the dependency-feed-check check passes

📋 Issue Type

  • Bug fix
  • Feature
  • Task

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
Copilot AI review requested due to automatic review settings July 16, 2026 20:08
@huzaifa-d
huzaifa-d requested a review from a team as a code owner July 16, 2026 20:08
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WslcCanRun reports WslPackage missing, 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.dll is 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

Comment on lines +320 to +336
fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String {
if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 {
return format!(
"WSLC runtime not available. Missing components: {:?}. The installed WSL \
package must be version 2.8.0 or newer. The WSLC SDK DLL is present, but \
the WSL runtime is missing or too old. Update WSL with `wsl --update` \
and verify the installed version with `wsl --version`.",
missing
);
}

format!(
"WSLC runtime not available. Missing components: {:?}. Ensure WSL2 and the \
WSLC SDK are installed.",
missing
)
}
Comment on lines 1329 to 1337
#[test]
fn wsl_package_prerequisite_error_explains_minimum_version() {
let message = wslc_prerequisite_error(WslcComponentFlags::WslPackage);

assert!(message.contains("2.8.0"));
assert!(message.contains("WSLC SDK DLL is present"));
assert!(message.contains("wsl --update"));
}
}
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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String {
if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 {
return format!(
"WSLC runtime unavailable. Missing components: {:?}. WSL 2.8.1 or newer \

@MGudgin MGudgin Jul 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string says 'runtime unavailable', the one at line 330 says 'runtime not available' as does line 241 of the .md file. Let's make them consistent.

ScriptResponse::error(&msg)
}

fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new helper has two user-facing message branches, but this PR adds no tests for either one. Please add table-driven tests covering WslPackage, VirtualMachinePlatform, and their combined value, asserting the version and remediation guidance selected for each case.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback Issue needs attention from issue or PR author label Jul 17, 2026
fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String {
if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 {
return format!(
"WSLC runtime unavailable. Missing components: {:?}. WSL 2.8.1 or newer \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jfyi, we are moving to the public release of 2.9 soon. That is the minimum publicly available version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs-Author-Feedback Issue needs attention from issue or PR author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wslc setup failed: WSLC runtime not available. Missing components: WslPackage. Ensure WSL2 and the WSLC SDK are installed.

5 participants