microsoft / microsoft/winget-cli
Repair-WinGetPackageManager does not detect provisioned but not registered state
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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