winget install reports success when MSIX registration fails with 0x80070005
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in src/AppInstallerCommonCore/Deployment.cpp, in WaitForDeployment, where the issue says WinGet checks the deployment result's extended error code. Trace how the async operation status and primary error code are handled, then inspect the related deployment tests. Done when a registration failure such as 0x80070005 is reported with a failure exit code while the existing package-in-use handling still works.
由索引模型根据 Issue 内容生成。
描述
Relevant area(s)
WinGet CLI
Relevant command(s)
winget install
Brief description of your issue
I ran winget install --id Microsoft.PowerShell and WinGet reported success. The 7.7.0 files were present under Program Files\WindowsApps, but pwsh was missing. Windows had staged the package and then denied registration for my account. WinGet logged both steps as successful.
Steps to reproduce
- Use a Windows account with a working WinGet catalog on a device with the effective
ApplicationManagement/BlockNonAdminUserInstallpolicy set to1. Start with PowerShell 7 absent for that account. On my machine I had removed the old MSI first. - From a non-elevated Windows PowerShell prompt, run
winget install --id Microsoft.PowerShell. In my repro this selected the 7.7.0 MSIX bundle. - Check
$LASTEXITCODE, then runGet-AppxPackage -Name Microsoft.PowerShellandTest-Path "$env:LOCALAPPDATA\Microsoft\WindowsApps\pwsh.exe".
Expected behavior
WinGet should report the registration error (0x80070005, access denied) and exit with a failure code.
Actual behavior
WinGet reported a successful install. Get-AppxPackage returned nothing and the alias was absent. Retrying registration for the same account in an elevated shell succeeded, and the alias then launched PowerShell 7.7.0.
WinGet log, Windows event, and registration API result
The WinGet log for the install contains these entries:
14:04:51.946 [CORE] Successfully completed #0
14:04:51.946 [CORE] Starting RegisterPackageByFullNameAsync operation #1: Microsoft.PowerShell_2026.1110.418.0_neutral_~_8wekyb3d8bbwe
14:04:51.950 [CORE] Successfully completed #1
14:04:51.988 [CLI ] Leaf command succeeded: root:install
Operation #0 was staging. At the same time as operation #1, the Windows AppX deployment log recorded event 404 for the same bundle, with CallingProcess=winget.exe and ErrorCode=0x80070005.
Repeating PackageManager.RegisterPackageByFullNameAsync directly from a non-elevated process let me inspect both results. The async operation had Status = Error and ErrorCode = E_ACCESSDENIED. Its DeploymentResult had IsRegistered = false, error text “Access is denied”, and no failing ExtendedErrorCode.
Proposed fix
In WaitForDeployment, WinGet checks only DeploymentResult.ExtendedErrorCode() after retrieving the result. I propose keeping the more specific extended HRESULT when one is available and falling back to the async operation’s primary ErrorCode() when its status is Error. That would preserve the existing handling for packages in use and surface the access denial in this case. Unless you folks prefer to take it yourselves, I could submit a PR once a maintainer agrees with the approach.
Related to #6499: the same policy is involved there, but that report concerns failure to initialize the WinGet catalog. Here the catalog worked and WinGet reported success for the requested app after registration failed.
Environment
Windows 11 24H2 x64, build 26100.9711 · WinGet v1.29.380 · Microsoft.DesktopAppInstaller 1.29.380.0
- 主要语言
- C++
- 星标
- 26.6k
- 派生
- 1.8k
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 42
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/winget-cli 的其他 Issue
-
Command-Install Needs-Triage
难度 2/5 1-3 小时 新手友好度 79/100
microsoft/winget-cli#6718 ·
维护者通常 2 天内回复
-
Issue-Docs Needs-Triage
难度 2/5 1-3 小时 新手友好度 70/100
microsoft/winget-cli#6692 ·
维护者通常 2 天内回复
-
Issue-Docs Possible-Duplicate
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/winget-cli#6493 · 1 条评论 ·
维护者通常 2 天内回复
-
Issue-Feature
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/winget-cli#6427 ·
维护者通常 2 天内回复
-
Issue-Docs msstore
难度 2/5 1-3 小时 新手友好度 64/100
microsoft/winget-cli#6331 · 1 条评论 ·
维护者通常 2 天内回复
查看 microsoft/winget-cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
cp-algorithms/cp-algorithms#1774 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
telefonicaid/fiware-orion#4836 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
SanderMertens/flecs#2463 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 2 天内回复
-
nixd exits at startup when its parent process belongs to another user可能已有人在做 @conao3 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
nix-community/nixd#930 ·
维护者通常 2 天内回复