Prevent crashes from partial in-place updates#4868
Merged
Conversation
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
June 3, 2026 14:55
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces an “update-in-progress” marker mechanism so UniGetUI won’t start while an in-place installer update is actively swapping binaries, reducing the risk of launching into a partially updated state.
Changes:
- Adds an
UpdateInProgressGuardinUniGetUI.Core.Dataand integrates it into both WinUI and Avalonia entry points to abort UI startup during updates. - Updates the Inno Setup installer to create/remove an update marker around the file copy window and improves process termination prior to install.
- Adds unit tests for the guard and exposes internals to the test assembly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
UniGetUI.iss |
Adds update marker lifecycle in installer + improved process-kill behavior and close-apps configuration. |
src/UniGetUI/EntryPoint.cs |
Blocks WinUI startup when an update marker is detected. |
src/UniGetUI.Core.Data/UpdateInProgressGuard.cs |
New guard that detects (and optionally cleans) the update marker in base/parent directories. |
src/UniGetUI.Core.Data/InternalsVisibleTo.cs |
Allows the test project to call internal guard overloads. |
src/UniGetUI.Core.Data.Tests/UpdateInProgressGuardTests.cs |
Adds tests validating marker detection/cleanup and the installer contract. |
src/UniGetUI.Avalonia/Program.cs |
Blocks Avalonia startup when an update marker is detected. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Jun 3, 2026
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.
This pull request introduces a mechanism to prevent application launches during in-progress updates, ensuring that UniGetUI does not start while its binaries are being replaced. It adds a file-based update-in-progress marker, logic to create and remove the marker during installation, and guards in both the Avalonia and classic entry points to abort startup if an update is detected. The update detection logic is fully tested, and installer process handling is improved to reliably terminate running instances and avoid file lock issues.
Update-in-progress detection and prevention:
UpdateInProgressGuardclass toUniGetUI.Core.Datathat detects the presence of an update-in-progress marker file and blocks UI startup if an update is underway. The guard checks both the current and parent directories, ignores stale markers, and is used by both the Avalonia and classic entry points (UpdateInProgressGuard.cs,EntryPoint.cs,Program.cs).UpdateInProgressGuardto ensure correct detection logic, marker cleanup, and contract with the installer (UpdateInProgressGuardTests.cs).UniGetUI.Core.Datato the test assembly viaInternalsVisibleTo(InternalsVisibleTo.cs).Installer improvements and integration:
UniGetUI.iss) to write the update-in-progress marker before copying files and remove it after installation, ensuring that any instance launched mid-update will abort. The marker file name is kept in sync with the guard logic.TaskKillwith a newTaskKillWaitthat reliably kills all relevant processes (including helpers), and setCloseApplications=forceto forcibly close any processes holding files to be overwritten.Installer deployment changes:
PrepareToInstall.These changes collectively make UniGetUI more robust during updates, preventing accidental launches into a partially updated state and improving reliability.