Skip to content

Address non-interactive MSIX uninstall 0x80070520 (#6579) - #6597

Open
Bearmancer wants to merge 3 commits into
microsoft:masterfrom
Bearmancer:fix/msix-non-interactive-uninstall
Open

Bearmancer wants to merge 3 commits into
microsoft:masterfrom
Bearmancer:fix/msix-non-interactive-uninstall

Conversation

@Bearmancer

@Bearmancer Bearmancer commented Oct 18, 2026 •

Copy link
Copy Markdown

📖 Description

When running winget uninstall <package> for an MSIX/Store package from a non-interactive session (Session 0: SSH, WinRM, background agent, CI), Deployment::RemovePackage calls PackageManager::RemovePackageAsync, which fails with 0x80070520 : A specified logon session does not exist. It may already have been terminated. — the AppX deployment broker requires an interactive logon session when the call is issued from a packaged context.

This change makes the MSIX uninstall path resilient in that situation:

  • Deployment::RemovePackage now inspects the deployment result instead of unconditionally rethrowing. On ERROR_NO_SUCH_LOGON_SESSION it treats the removal as successful when the package is no longer registered for the user, and otherwise falls back to an unpackaged Remove-AppxPackage invocation (hidden window, bounded wait), re-checking registration afterwards.
  • UninstallFlow no longer reports a false failure for 0x80070520 when the package family is not registered for the user; it logs the condition and continues.

🔗 References

Fixes #6579

🔍 Validation

✅ Checklist

🤖 AI Assistance

  • AI assistance was used and has been disclosed in this PR
  • No AI assistance was used

📋 Issue Type

  • Bug fix
  • Feature
  • Task

@Bearmancer
Bearmancer requested a review from a team as a code owner October 18, 2026 13:18
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

This comment has been minimized.

@Bearmancer

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Bearmancer

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

winget uninstall of a Store/MSIX package fails with 0x80070520 in a non-interactive session

1 participant