Repository navigation
Announce the first HUD frame presented after a host-window retry - #189
Merged
Merged
Conversation
HudNativeHostTests failed once in the nightly suite and once in a full local run at the host-window retry step: after the injected ClientToScreen failure the status stayed "host window retry after ClientToScreen (0x80070578)" with one retry counted for the whole 4 s window. The retry itself ran: RestartRendererAfterRelease cleared _retryPending after 500 ms and the host captured and synchronized its window again. What never came was the acknowledgement. HudNativeHostRecovery.Presented and the Ready status run only from OnPresented, and the render worker raises HudPresented only when a presented snapshot is not compatible with the last announced one. The retried capture presents the same scene, so the retry was closed only when a scene change happened to follow. The test passed whenever the OnPresented callback of the previous stage's frame was still queued on the dispatcher when the failure was injected, which depends on where that frame landed between two pumps. In the application the same gap left the status on the retry text and kept counting isolated failures in one episode until the car or layout changed. The host now asks the worker to announce the first frame presented from the snapshot captured by the retry, so OnPresented ends the retry and reports Ready for an unchanged scene as well. The request is made at the retry, not at the failure, so a frame presented before the window was synchronized again does not count.
Owner
Author
|
Full nightly dispatched on this branch (run 42509178650, workflow_dispatch, windows-latest): Full behavioral and UI checks passed, 6130 of 6130 application tests including the HudNativeHostTests stage. One pass is weak evidence for a timing-dependent failure; the code reading in the description is the basis of the fix. |
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.
Failure.
HudNativeHostTests(insideWpfStyleRuntimeTests.ApplicationStylesAndNativeControlsPassRuntimeChecks) failed in the nightly dispatched on the #188 branch (run 42505910128) and once in a full local run on 2026-11-07, both at the host-window retry step: after the injectedClientToScreenfailure the status stayed on "host window retry after ClientToScreen (0x80070578)" withretries=1for the whole 4 s window. It passed in the nightlies of 11-06, 11-07 and twice on 11-08.Cause, from the code. The retry runs:
RestartRendererAfterReleaseclears_retryPendingafter 500 ms and the host captures and synchronizes its window again. The acknowledgement never comes for an unchanged scene:HudNativeHostRecovery.Presented()and the Ready status run only fromOnPresented, andAnalogHudRenderWorkerraisesHudPresentedonly when a presented snapshot is not compatible with the last announced one (HudWindowSnapshot.CompatibleWith, keyed on car, unit, redline, layout, colors and so on, not on time). The test's seed changes only timestamps, so the retried capture presents a compatible scene and nothing fires. The stage passed whenever the previous stage'sOnPresentedcallback was still queued on the dispatcher when the failure was injected, which depends on where that frame landed between two pumps. That is the intermittency.Product consequence. This is a gap in #183, not only a test problem. In the application a single transient host-window failure leaves the status on the retry text and keeps
Retriesat 1 until the car or layout changes, so isolated failures hours apart accumulate in one episode, and the fourth releases the host and blanks the HUD until the next game attach or foreground return, contrary to the design note inHudNativeHostRecovery.cs("a presented frame proves the host window works"). Wisp 2.7.4 shipped with this behavior.Change.
HudNativeHostsets_announceRetriedHostin the retry callback and passes it toAnalogHudRenderWorker.UpdateHud(..., announce: true)from the retriedCapture; the worker clears its last announced scene when it dequeues that snapshot, so the first frame presented from it raisesHudPresentedas before for a changed scene. The request is made at the retry, not at the failure, so a frame presented before the window was synchronized again does not close the retry. If the retriedSynchronizethrows,Capturedoes not reachUpdateHudand the flag survives to the next retry. Flags are written and read under the worker's existing gate or on the dispatcher thread. No timing, interval or drawing path changes; the added work is oneOnPresentedround trip per retry.Checked.
Wisp.App.Testsbuilt once;WpfStyleRuntimeTestsrun once on the maintainer PC with the change: the HUD host stage (retry and rebuild steps) passed, and the class failed only at the known 200 % display-scaling label-fit check that is unrelated and does not reproduce on the CI runner. The full nightly is dispatched on this branch; its result is recorded in a comment.Not verified. The intermittent failure was not reproduced (forcing it needs an injected dispatcher delay). The diagnosis rests on reading the code and matches the recorded signature. No in-game check of a real host-window failure on the Store build; the live behavior is inferred from the same code path.