Get-WinGetPackage in 1.29.380 fails with "Failed to create instance: -2147023174" in an elevated PowerShell session

オープン
#6,560 コメント 13 件 リアクション 5 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, powershell
領域
backend, cli

調査の方向性

The issue is in the PowerShell module Microsoft.WinGet.Client, specifically the Get-WinGetPackage command. Start by examining the COM interop code in the module that creates the instance, likely in the GetPackageCmdlet class. Compare the changes between versions 1.29.280 and 1.29.380 to identify what broke elevated session support. Test the fix in an elevated PowerShell session on Windows Server 2025 to confirm the error is resolved.

索引モデルが issue の本文から書いたものです。

説明

Issue-Bug PowerShell
Relevant area(s)

PowerShell Module

Relevant command(s)

Get-WinGetPackage. I did not test other commands, so those might be affected as well.

Brief description of your issue

Get-WinGetPackage in 1.29.380 fails with "Failed to create instance: -2147023174" in an elevated PowerShell session.

Steps to reproduce

In an elevated PowerShell session (tested with Windows Server 2025, the built-in Administrator account and the built-in PowerShell version):

Uninstall-Module Microsoft.WinGet.Client
Install-Module -Name Microsoft.WinGet.Client -RequiredVersion 1.29.280
Get-WinGetPackage

Note that Get-WinGetPackage outputs the list of installed packages. Now let's try the same with 1.29.380:

Uninstall-Module Microsoft.WinGet.Client
Install-Module -Name Microsoft.WinGet.Client -RequiredVersion 1.29.380
Get-WinGetPackage
Expected behavior

Get-WinGetPackage behaves like in 1.29.280.

Actual behavior
Get-WinGetPackage : Failed to create instance: -2147023174
At line:1 char:1
+ Get-WinGetPackage
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-WinGetPackage], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.WinGet.Client.Commands.GetPackageC
   mdlet

Get-WinGetPackage works in a non-elevated PowerShell session.
Reverting to 1.29.280 (see above) fixes the issue.

Environment
Windows Package Manager v1.11.510
Windows: Windows.Server v10.0.26100.32522
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.26.510.0
主要言語
C++
スター
26.6k
フォーク
1.8k
平均マージ
3日 10時間
マージ済み PR(30日)
41

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/winget-cli のほかの issue

microsoft/winget-cli の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。