Local repository: Find/Save/Install fail with TryConvertFromHashtableForPsd1 NullReferenceException when RequiredModules is a single hashtable (e.g. dbatools)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
調査の方向性
Reproduce the failure with the provided Repro.Single and Repro.Array manifest script, then trace the TryConvertFromHashtableForPsd1 path named in the error. Add a regression test for a single-hashtable RequiredModules value and verify Find-PSResource, Save-PSResource, and Install-PSResource handle it like the array form.
索引モデルが issue の本文から書いたものです。
説明
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
I think the following is correct, Claude Code suggested I raise it!
Steps to reproduce
RequiredModules = @{ ModuleName = 'X'; ModuleVersion = '1.0.0' } (a single hashtable, not wrapped in @()) is a valid module manifest. Import-Module, Test-ModuleManifest and the PowerShell Gallery all accept it, and dbatools uses it (dbatools 2.9.0 requires dbatools.library this way). But PSResourceGet cannot find, save or install such a package from a local (file-share) repository, even with -SkipDependencyCheck. The same manifest with RequiredModules = @(@{ ... }) works.
$Work = Join-Path ([IO.Path]::GetTempPath()) ([guid]::NewGuid())
New-Item -ItemType Directory -Path "$Work\pkg", "$Work\out" -Force | Out-Null
foreach ($Case in @{ Name = 'Repro.Single'; Requires = "@{ ModuleName = 'Repro.Lib'; ModuleVersion = '1.0.0' }" },
@{ Name = 'Repro.Array'; Requires = "@(@{ ModuleName = 'Repro.Lib'; ModuleVersion = '1.0.0' })" }) {
$Src = New-Item -ItemType Directory -Path "$Work\src\$($Case.Name)" -Force
Set-Content "$Src\$($Case.Name).psm1" ''
Set-Content "$Src\$($Case.Name).psd1" "@{ RootModule = '$($Case.Name).psm1'; ModuleVersion = '1.0.0'; GUID = '$([guid]::NewGuid())'; Author = 'T'; Description = 'T'; RequiredModules = $($Case.Requires) }"
Compress-PSResource -Path $Src -DestinationPath "$Work\pkg" -SkipModuleManifestValidate
}
Register-PSResourceRepository -Name Repro -Uri "$Work\pkg" -Trusted
Save-PSResource -Name Repro.Array -Version 1.0.0 -Repository Repro -Path "$Work\out" -TrustRepository -SkipDependencyCheck # works
Save-PSResource -Name Repro.Single -Version 1.0.0 -Repository Repro -Path "$Work\out" -TrustRepository -SkipDependencyCheck # fails
Unregister-PSResourceRepository -Name Repro
The same happens with the real package: Save-PSResource -Name dbatools -AsNupkg from PSGallery, register that folder as a repository, then Find-PSResource -Name dbatools -Repository <it>.
Find-PSResource and Install-PSResource fail the same way. A package that depends on dbatools then fails with Dependency package with name 'dbatools' could not be found in repository.
Expected behavior
`Repro.Single` is found and saved, as `Repro.Array` is, with `Repro.Lib` as its dependency.
Actual behavior
Save-PSResource: TryConvertFromHashtableForPsd1: Could not find expected information from module manifest file hashtable with error: Object reference not set to an instance of an object.
Error details
Environment data
PowerShell 7.x, Windows 11 Enterprise 10.0.26200
Microsoft.PowerShell.PSResourceGet 1.2.0
Visuals
No response
- 主要言語
- C#
- スター
- 577
- フォーク
- 114
- 平均マージ
- 23時間 17分
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PowerShell/PSResourceGet のほかの issue
-
Create parent directories only after the containment check in InstallHelper.TryExtractToDirectoryオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
PowerShell/PSResourceGet#2056 ·
メンテナーはふだん 1 日以内に返信
-
feature_request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
PowerShell/PSResourceGet#2013 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Needs-Triage
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
PowerShell/PSResourceGet#2060 ·
メンテナーはふだん 1 日以内に返信
-
Use GitHub app token to authenticate to GitHub resources対応中かも @adityapatwardhan が 12 日前に担当しました。 オープンfeature_request Needs-Triage
PowerShell/PSResourceGet#2057 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Needs-Triage
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
PowerShell/PSResourceGet#2055 ·
メンテナーはふだん 1 日以内に返信
PowerShell/PSResourceGet の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
elsa-workflows/elsa-core#8593 ·
メンテナーはふだん 1 日以内に返信
-
WebSocket upgrade check is case-sensitive for `Upgrade`対応中かも @S0CloseYetS0Far が今日担当しました。 オープンbug good first issue severity:low
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
NEW ISSUE Requestor-TML Maintainers Type: Change/Feature Request
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
tModLoader/tModLoader#5476 ·
メンテナーはふだん 1 日以内に返信
-
Issue-Enhancement Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
PowerShell/PowerShell#28138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SubtitleEdit/subtitleedit#15600 ·
メンテナーはふだん 1 日以内に返信