microsoft / microsoft/winget-cli

Repair-WinGetPackageManager does not detect provisioned but not registered state

Open
#4,603 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

Repair-WinGetPackageManager does not detect the state where the package has been provisioned for the machine but not registered for the user. This may lead to a failure if the provisioning step does an async registration that does not complete before we attempt to check for the registration side effects.

Detecting this state is complicated by the fact that there is no obvious way to use the PS commands to find a staged package without elevation. If we are running elevated, we can add -AllUsers to the existing check as a fix. If not, we either need to request changes to Get-AppxPackage or find another mechanism.

Steps to reproduce

Provision the package, then remove it for the user. Note that the repair state machine will detect this as "not installed" rather than "not registered".

Expected behavior

The repair state machine registers the package.

Actual behavior

The repair state machine determines "not installed", leading to unnecessary downloads or an error if the provisioning of the previous state didn't register for the user in time.

Environment
Latest PS module: 1.8.1791

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Repair-WinGetPackageManager repair state machine and inspect its existing Get-AppxPackage check. Reproduce the provisioned-for-machine but unregistered-for-user state by provisioning the package and removing it for the user, then determine how the check behaves elevated and without elevation. Done means the state is detected as not registered and the repair registers the package without unnecessary downloads.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.