Skip to content

Rebuild the HUD host after failed window calls instead of retiring it - #183

Merged
Views2k merged 2 commits into
mainfrom
fix/hud-host-retry-latch
Nov 8, 2026
Merged

Views2k merged 2 commits into
mainfrom
fix/hud-host-retry-latch

Conversation

@Views2k

@Views2k Views2k commented Nov 7, 2026

Copy link
Copy Markdown
Owner

On Microsoft Store builds, a host-window Win32 call failed at alt-tab return or game attach four times 500 ms apart, after which HudNativeHost latched _failed for the rest of the run; nothing cleared it and the HUD window stayed blank until Wisp restarted. 3 PCs on 2.7.2 and 2.7.3. Every failure was reported as E_FAIL, so the failing call was unknown.

Changes

  • Diagnostics: host-window failures carry HRESULT_FROM_WIN32(NativeErrorCode) and the failing call's name (NativeHostInteropException), and one breadcrumb is recorded per episode instead of one per failed call.
  • Recovery (HudNativeHostRecovery): when the retries run out, the host is released and rebuilt on the next AttachAboveGame, once per attach, with a bound of three failed episodes before today's permanent failure. A presented frame resets the count. The WPF artwork stays suppressed while the native host is in use, as before.

Tests: HudNativeHostRecoveryTests (four failures then success recovers on the next attach; three episodes retire; failure details carry the Win32 code and call name) and an addition to HudNativeHostTests.

Tools note: renderer-host incidents now arrive once per episode and with Win32-derived codes instead of 0x80004005.

Verification

  • Integration build of main plus all seven 2.7.4 fix branches on the maintainer PC: build clean, dotnet format whitespace --verify-no-changes clean.
  • PR gate selection (Test-AppBehavior.ps1 -BaseRevision main) on that build: Core 780, Telemetry 96, Update 184, Updater 76 and App 1295 tests passed, 0 failed.
  • Not run: the full nightly suite (runs before the 2.7.4 tag) and a live Store alt-tab check; the failing call is only known once a 2.7.4 report arrives.

A host-window Win32 call (CreateWindowEx, GetClientRect, ClientToScreen,
MonitorFromWindow, GetMonitorInfo, SetWindowLongPtr or SetWindowPos) can
fail while the game attaches or the player returns from another window.
After four failures 500 ms apart the HUD window's native renderer was
retired for the rest of the run: the failed flag was never cleared and
HUD windows are created once, so that window stayed blank until Wisp was
restarted. The failure report carried E_FAIL, which every Win32Exception
reports, so neither the Win32 error nor the failing call was known.

Host-window failures are now named at each call site and reported once
per episode with HRESULT_FROM_WIN32 of the Win32 error code, in the
breadcrumb and in the renderer status text. When an episode's retries
run out, the host window and its renderer are released and built again
on the next attach above the game (game start or foreground return), at
most once per such event. Three consecutive exhausted episodes without a
presented frame fall back to the previous permanent failure. The WPF
artwork stays suppressed throughout, as before.

Tests cover the retry, rebuild and retirement bounds, the failure
details, and a live host that is released after four failed
synchronizations and presents again through a new HWND after the next
attach.
@Views2k
Views2k merged commit 08751a8 into main Nov 8, 2026
10 checks passed
@Views2k
Views2k deleted the fix/hud-host-retry-latch branch November 8, 2026 00:23
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.

1 participant