winget install reports success when MSIX registration fails with 0x80070005

Đang mở
#6,715 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend, cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Command-Install Needs-Triage
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
  1. Use a Windows account with a working WinGet catalog on a device with the effective ApplicationManagement/BlockNonAdminUserInstall policy set to 1. Start with PowerShell 7 absent for that account. On my machine I had removed the old MSI first.
  2. From a non-elevated Windows PowerShell prompt, run winget install --id Microsoft.PowerShell. In my repro this selected the 7.7.0 MSIX bundle.
  3. Check $LASTEXITCODE, then run Get-AppxPackage -Name Microsoft.PowerShell and Test-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

Ngôn ngữ chính
C++
Star
26.6k
Fork
1.8k
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
42

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/winget-cli

Tất cả issue của microsoft/winget-cli

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.