Fix Session Host startup logging after WinRT shutdown - #6
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An unpackaged Session Host should refuse startup safely, but it exits with
0xC0000005instead.run()first gets a normal no-package error fromApplicationData::Current(), then drops its WinRT guard. The executable subsequently calls startup logging, which queries the cached factory afterRoUninitialize.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
0xC0000005before the change and passed afterward.cargo test --locked --target aarch64-pc-windows-msvc --all-features --all-targets: 486 passed, 5 intentionally ignored.--all-features --lib --bins -- -D warnings), formatting, C-header/TLS checks, and all 8 script tests passed.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 basefb1b53f.RuntimeThreadGuardcurrently puts its state mutation insidedebug_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.