Skip to content

Fix Session Host startup logging after WinRT shutdown - #6

Merged
yiguodev merged 1 commit into
mainfrom
fix/windows-unpackaged-session-host
Sep 11, 2026
Merged

yiguodev merged 1 commit into
mainfrom
fix/windows-unpackaged-session-host

Conversation

@yiguodev

Copy link
Copy Markdown
Contributor

Problem

An unpackaged Session Host should refuse startup safely, but it exits with 0xC0000005 instead. run() first gets a normal no-package error from ApplicationData::Current(), then drops its WinRT guard. The executable subsequently calls startup logging, which queries the cached factory after RoUninitialize.

A minimal Windows probe reproduced the access violation on that second query. Dropping the original error after uninitialization did not crash; reinitializing before reusing the cached factory did not fix the problem.

Change

Keep startup and best-effort failure logging inside the same WinRT initialization lifetime. Make the logging helper private, and add a bounded process-level regression test that refuses to run with package identity. There is no fallback storage location, new activation path, exit-code whitelist, or protocol/ABI revision change.

Validation

  • The regression failed with 0xC0000005 before the change and passed afterward.
  • ARM64 and x64 Release regression tests passed on Windows 11 ARM64; x64 execution was emulated.
  • cargo test --locked --target aarch64-pc-windows-msvc --all-features --all-targets: 486 passed, 5 intentionally ignored.
  • Clippy (--all-features --lib --bins -- -D warnings), formatting, C-header/TLS checks, and all 8 script tests passed.
  • The normal ARM64 artifact build passed its architecture and build-identity checks.

The expanded full Release test run uncovered an independent existing failure in ffi::tests::runtime_thread_cannot_reenter_invoke; it was also reproduced on unchanged base fb1b53f. RuntimeThreadGuard currently puts its state mutation inside debug_assert!, so release builds omit it. This PR deliberately does not modify that separate FFI boundary.

No packaged activation, live VPN, Windows 10, or native x64 acceptance is claimed.

Copilot AI balanced review requested due to automatic review settings September 11, 2026 04:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yiguodev
yiguodev merged commit 400f48f into main Sep 11, 2026
1 check passed
@yiguodev
yiguodev deleted the fix/windows-unpackaged-session-host branch September 11, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants