Finish the preload display callback before the launcher exits #534

Open
holoslicer wants to merge 1 commit from holoslicer/Darner:fix/wait-for-preload-window-close into Main
Contributor

Contributor role (optional)

Already requested in #529.

What it changes

After a completed preload on Windows, the PowerShell launcher showed a stuck .NET dialog with System.Management.Automation.PipelineStoppedException in a WinForms callback. The preload had returned exit code 0 and saved its pipeline library.

Close-PreloadWindow previously set a flag and returned immediately. The 50 ms WinForms timer could still be running when PowerShell exited. The launcher now waits for the window's pipeline to finish, consumes its result and disposes the PowerShell instance and its STA runspace. A five-second bound lets the launcher continue if the UI thread is unresponsive. Repeated calls after a normal close are safe.

How it was tested

  • Tested 0d7bf3a against c8258f9 with Windows PowerShell 5.1 and Pester 3.4. The game stayed closed.
  • Run Invoke-Pester .\scripts\tests\preload-window.Tests.ps1. To reproduce on the base, use the same test file with its original scripts/preload-window.ps1. The test uses the real launcher functions, an STA runspace, a WinForms timer and its message loop. It opens no windows.
  • Base returned while the UI callback was unfinished and failed the assertion. The patch passed an immediate close, a close during the message loop, a display already closed by the user, and a second close after each.
  • The complete PowerShell launcher suite passed all 38 tests on the final commit with Invoke-Pester .\scripts\tests.
  • This changes teardown of the PowerShell splash. The render path, preload work and native progress display use their existing behavior. The Rust workspace gates were not run on this script-only revision.

Checklist

  • The regression test reproduced the unfinished callback on the base and passed on the change.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • This patch has no prerequisites.

Checked for overlap

  • Searched open and closed issues and PRs for the stopped pipeline, stuck preload windows, and the launcher function and file.
  • #166 discusses the two progress windows. #492 proposes removing this PowerShell display. This fix applies to launchers using the display on current main.
## Contributor role (optional) Already requested in #529. ## What it changes After a completed preload on Windows, the PowerShell launcher showed a stuck .NET dialog with `System.Management.Automation.PipelineStoppedException` in a WinForms callback. The preload had returned exit code 0 and saved its pipeline library. `Close-PreloadWindow` previously set a flag and returned immediately. The 50 ms WinForms timer could still be running when PowerShell exited. The launcher now waits for the window's pipeline to finish, consumes its result and disposes the PowerShell instance and its STA runspace. A five-second bound lets the launcher continue if the UI thread is unresponsive. Repeated calls after a normal close are safe. ## How it was tested - Tested `0d7bf3a` against `c8258f9` with Windows PowerShell 5.1 and Pester 3.4. The game stayed closed. - Run `Invoke-Pester .\scripts\tests\preload-window.Tests.ps1`. To reproduce on the base, use the same test file with its original `scripts/preload-window.ps1`. The test uses the real launcher functions, an STA runspace, a WinForms timer and its message loop. It opens no windows. - Base returned while the UI callback was unfinished and failed the assertion. The patch passed an immediate close, a close during the message loop, a display already closed by the user, and a second close after each. - The complete PowerShell launcher suite passed all 38 tests on the final commit with `Invoke-Pester .\scripts\tests`. - This changes teardown of the PowerShell splash. The render path, preload work and native progress display use their existing behavior. The Rust workspace gates were not run on this script-only revision. ## Checklist - [x] The regression test reproduced the unfinished callback on the base and passed on the change. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] This patch has no prerequisites. ## Checked for overlap - [x] Searched open and closed issues and PRs for the stopped pipeline, stuck preload windows, and the launcher function and file. - #166 discusses the two progress windows. #492 proposes removing this PowerShell display. This fix applies to launchers using the display on current main.
holoslicer changed title from WIP: [pr-fix][startup] Finish the preload display callback before the launcher exits to [pr-fix][startup] Finish the preload display callback before the launcher exits 2026-12-05 08:35:50 +00:00
TrustNo1 changed title from [pr-fix][startup] Finish the preload display callback before the launcher exits to Finish the preload display callback before the launcher exits 2026-12-06 03:27:36 +00:00
Owner

Test needed — commit 0d7bf3af; what to check:

After a completed preload on Windows, the PowerShell launcher showed a stuck .NET dialog with System.Management.Automation.PipelineStoppedException in a WinForms callback. The preload had returned exit code 0 and saved its pipeline library.

Close-PreloadWindow previously set a flag and returned immediately. The 50 ms WinForms timer could still be running when PowerShell exited. The launcher now waits for the window's pipeline to finish, consumes its result and disposes the PowerShell instance and its STA runspace. A five-second bound lets the launcher continue if the UI thread is unresponsive. Repeated calls after a normal close are safe.

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `0d7bf3af`; what to check: After a completed preload on Windows, the PowerShell launcher showed a stuck .NET dialog with `System.Management.Automation.PipelineStoppedException` in a WinForms callback. The preload had returned exit code 0 and saved its pipeline library. `Close-PreloadWindow` previously set a flag and returned immediately. The 50 ms WinForms timer could still be running when PowerShell exited. The launcher now waits for the window's pipeline to finish, consumes its result and disposes the PowerShell instance and its STA runspace. A five-second bound lets the launcher continue if the UI thread is unresponsive. Repeated calls after a normal close are safe. Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/wait-for-preload-window-close:holoslicer-fix/wait-for-preload-window-close'
git switch 'holoslicer-fix/wait-for-preload-window-close'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'holoslicer-fix/wait-for-preload-window-close'
git switch 'holoslicer-fix/wait-for-preload-window-close'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'holoslicer-fix/wait-for-preload-window-close'
git switch 'holoslicer-fix/wait-for-preload-window-close'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'holoslicer-fix/wait-for-preload-window-close'
git switch 'Main'
git merge --squash 'holoslicer-fix/wait-for-preload-window-close'
git switch 'Main'
git merge --ff-only 'holoslicer-fix/wait-for-preload-window-close'
git switch 'Main'
git merge 'holoslicer-fix/wait-for-preload-window-close'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!534
No description provided.