Skip to content

Fix "Uninstall package, then update it" failing on WinGet packages#5077

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/uninstall-then-update-double-run
Jul 13, 2026
Merged

Fix "Uninstall package, then update it" failing on WinGet packages#5077
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/uninstall-then-update-double-run

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request makes important corrections to the uninstall-then-reinstall and uninstall-then-update workflows for package management, ensuring operations are not executed twice and that updates after uninstall are handled correctly.

Bug fixes and workflow corrections:

  • In InstalledPackagesPage.cs, removed the direct launch of uninstallOp in LaunchUninstallThenReinstall to prevent running the uninstall operation twice concurrently, since it's already a prerequisite for the reinstall operation.
  • In SoftwareUpdatesPage.cs, changed the second step of LaunchUninstallThenUpdate from an update to a fresh install operation, because after uninstalling, the package must be installed anew rather than updated. Also removed the direct launch of uninstallOp to avoid concurrent execution, as it's now a prerequisite for the install operation.

@GabrielDuf Gabriel Dufresne (GabrielDuf) linked an issue Jul 13, 2026 that may be closed by this pull request
4 tasks
@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 9ae6451 into main Jul 13, 2026
14 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/uninstall-then-update-double-run branch July 13, 2026 15:05
uninstallOp.OperationFailed += (_, _) => TelemetryHandler.UninstallPackage(package, TEL_OP_RESULT.FAILED);
var updateOp = new UpdatePackageOperation(package, updateOpts, req: uninstallOp);
// Once uninstalled the package is gone, so the second step must install the new version fresh; a plain update would fail with "no installed package found".
var updateOp = new InstallPackageOperation(package, updateOpts, req: uninstallOp);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're now changing the process to instead install the package, shouldn't we be renaming the menu option to reflect the changes too in order to avoid confusion? For example, changing "Uninstall package, then update it" to "Uninstall package, then install latest".

@Infinitay

Copy link
Copy Markdown

I can confirm this is now working correctly. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Failing to uninstall package, then update it

3 participants