KEMBAR78
More graceful MSIX enumeration failure handling by JohnMcPMS · Pull Request #5329 · microsoft/winget-cli · GitHub
Skip to content

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Mar 27, 2025

Fixes #5318
Mitigates many other issues getting 0x80070490 from installed package enumeration

Change

Check for IPackageManager9 before using it to prevent an AV on older Windows versions.

Attempt to FindPackagesForUserWithPackageTypes with fewer types if it fails with E_NOT_SET. While this is an OS issue, enumerating fewer (or no) packages is generally better than an error that completely blocks usage.

Validation

Manually tried both user and system scopes to ensure proper mainline functionality.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS JohnMcPMS requested a review from a team as a code owner March 27, 2025 19:10
@microsoft-github-policy-service microsoft-github-policy-service bot added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Mar 27, 2025
{
try
{
packages = packageManager.FindPackagesForUserWithPackageTypes({}, types);
Copy link
Contributor

Choose a reason for hiding this comment

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

if Main | Framework failed, does enumerating Main and Framework individually and combining the results work?

Copy link
Member Author

Choose a reason for hiding this comment

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

My assumption is that this issue is caused by some package's state being corrupted. Hopefully if it is just one package, then it must either be a Main OR a Framework. Attempting to get that one will also fail, and we can enumerate the other list. But this is all speculation on the actual issue.

A MUCH larger change would surface this inability to enumerate the packages and allow the code with context to decide how to proceed like we do with the errors from available catalogs. But on thinking through the implications here, I think it is better to allow reduced functionality rather than hard error. In the cases where it matters, it probably means doing extra work. In the cases where it doesn't matter, it means success instead of the current error.

@JohnMcPMS JohnMcPMS merged commit 4fbbf0e into microsoft:master Mar 28, 2025
9 checks passed
@JohnMcPMS JohnMcPMS deleted the deployment-fixes branch March 28, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue-Bug It either shouldn't be doing this or needs an investigation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows 10 v1809 and Server 2019 support was lost after v1.7.3481-preview

2 participants