Prevent window from pulling forward before UAC prompts - #5353
Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits intoSep 4, 2026
Merged
Prevent window from pulling forward before UAC prompts#5353Gabriel Dufresne (GabrielDuf) merged 2 commits into
Gabriel Dufresne (GabrielDuf) merged 2 commits into
Conversation
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
September 4, 2026 19:31
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Verify UniGetUI owns the foreground before granting foreground rights.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Refactors foreground-rights delegation before UAC elevation to avoid forcibly activating UniGetUI.
Changes:
- Removes UI-driven window activation.
- Makes foreground delegation synchronous.
- Updates elevation call sites and documentation.
File summaries
| File | Description |
|---|---|
src/UniGetUI.PackageEngine.Operations/AbstractProcessOperation.cs |
Uses synchronous delegation before elevation. |
src/UniGetUI.Core.Tools/Tools.cs |
Centralizes delegation but lacks the required foreground-process check. |
src/UniGetUI.Core.Data/CoreData.cs |
Removes the obsolete UI delegate. |
src/UniGetUI.Avalonia/Views/MainWindow.axaml.cs |
Removes foreground-activation wiring. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
September 4, 2026 19:43
View session
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The ASFW_ANY documentation must accurately describe its process-wide foreground delegation.
Review details
Suppressed comments (1)
src/UniGetUI.Core.Tools/Tools.cs:759
ASFW_ANYdelegates foreground permission to every process, not only the consent UI, as the comment above the constant also notes. Reword this to avoid promising a restriction the API does not provide while retaining the guarantee that this method does not activate UniGetUI itself.
/// Either way this only ever lets the consent UI come forward; it never activates our
/// own window, so a minimized UniGetUI stays minimized (#5102). No-op elsewhere.
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉
Integration Details
{
"deliveryId": "10542a50-a899-11f1-8d98-d73c0b2b2be5",
"headSha": "a884005c53e3d569b2a234436121a97ec3fec506",
"reviewer": "copilot-pull-request-reviewer[bot]"
}
Gabriel Dufresne (GabrielDuf)
deleted the
fix/5102-elevation-foreground-regression
branch
September 4, 2026 20:10
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 refactors how UniGetUI handles foreground window rights before showing a UAC consent prompt. The main change is to simplify and centralize foreground delegation logic, ensuring the app never unintentionally activates or brings forward the main window, which could disrupt the user. The previous mechanism using a delegate from the UI layer is removed in favor of a direct call that only delegates foreground rights if the app already owns the foreground.
Foreground rights delegation refactor:
CoreData.BringMainWindowToForegroundAsyncdelegate and all related UI-layer logic, eliminating the ability for the UI to forcibly bring the main window to the foreground before elevation. [1] [2] [3]CoreTools.PrepareForegroundForElevationAsync()to a synchronousPrepareForegroundForElevation()method that only delegates foreground rights without activating the window, and updated all call sites accordingly. [1] [2] [3]Documentation improvements: