Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Local repository: Find/Save/Install fail with TryConvertFromHashtableForPsd1 NullReferenceException when RequiredModules is a single hashtable (e.g. dbatools)

Offen
#2,059 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
powershell
Bereich
cli, tooling

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Needs-Triage
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

Vorherrschende Sprache
C#
Sterne
578
Forks
114
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus PowerShell/PSResourceGet

Alle Issues in PowerShell/PSResourceGet

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.