Skip to content

Resolve MSI installed scope from native installation context - #6644

Open
greyhair-atx (greyhair-atx) wants to merge 2 commits into
microsoft:masterfrom
greyhair-atx:fix/msi-installation-context-3011
Open

greyhair-atx (greyhair-atx) wants to merge 2 commits into
microsoft:masterfrom
greyhair-atx:fix/msi-installation-context-3011

Conversation

@greyhair-atx

@greyhair-atx greyhair-atx (greyhair-atx) commented Nov 1, 2026 •

Copy link
Copy Markdown

📖 Description

Resolve MSI installation scope using Windows Installer context instead of inferring it solely from the ARP registry hive. A user-unmanaged MSI can appear under HKLM, causing WinGet to reject --scope user or select a machine installer during an unscoped upgrade.

Enumerate current-user and machine registrations once per inventory helper, cache case-insensitive ProductCode/context mappings, and filter both ARP hives by the resolved scope. Preserve hive-based behavior for non-MSI entries. Missing/ambiguous MSI context and enumeration errors fail closed by omitting affected MSI inventory rather than guessing a scope. This conservative inventory change deserves particular review; it does not repair MSI transaction rollback.

🔗 References

Addresses #3011. Reproduction and published installer identities: #3011 (comment).

🔍 Validation

  • Release x64 targeted CLI and AppInstallerCLITests builds on base c608376; full-solution build not completed (unrelated DesktopBridge/E2E restore issues). Local build used SpectreMitigation=false because the relevant libraries were unavailable; NuGet advisory warnings were not treated as errors. These are test binaries, not distribution builds.
  • Selection [msiscope],[arphelper],[manifest_comparator],[installed]: 45 cases / 1,521 assertions locally; 45 / 1,289 on the Windows 11 disposable VM's standard-user interactive session. Local selection repeated successfully before submission.
  • New cases cover managed/unmanaged/machine contexts, current-user-only enumeration, case folding, sticky ambiguity, short SID-buffer retry, partial enumeration failure, non-MSI retention, and user/machine source filtering across ARP hives.
  • VM REST 1.4 catalog: eight successful package-specific upgrades covering user/machine, explicit/unscoped commands, and latest-only/both-version metadata. Verified native context, signed executable/hash, settings and final uninstall. A ninth incompatible-scope scenario rejected before removing the old user MSI.
  • Not tested: production publishing/preindexed catalog, upgrade --all, all supported Windows releases, or general installer failure recovery. Separate forced-failure MSI tests did not restore complete registration; this PR makes no rollback-safety claim.

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • Added a release note fragment
  • Updated documentation (release note)
  • Added tests
  • Updated Copilot instructions (no build/architecture/convention changes)

🤖 AI Assistance

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

AI assistance contributed the implementation, regression tests, disposable-VM test orchestration and this description. The contributor remains responsible for review and validation.

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

Spelling follow-up: commit b7de1ab acknowledges five Windows Installer API/test terms in the existing dictionary. Executable code is unchanged. The CLA and spelling checks passed; native Azure Pipelines validation still awaits an authorized upstream maintainer.

@greyhair-atx
greyhair-atx (greyhair-atx) requested a review from a team as a code owner November 1, 2026 20:14
@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.

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.

1 participant