Open
Description
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
Find/Save/Install-PSResourceGet fails with some Nuget v3 repositories, ex. https://preview.pwsh.gallery, using latest preview.
This is likely caused by the mandatory checks for @id
in dependencyGroup and dependencies introduced in #1778.
PSResourceGet/src/code/PSResourceInfo.cs
Lines 728 to 730 in 06aec34
PSResourceGet/src/code/PSResourceInfo.cs
Lines 737 to 740 in 06aec34
@id
is not listed as required in docs for dependencyGroup and dependencies, so we should probably not rely on them.
/cc @o-l-a-v
Expected behavior
Find-PSResource, Save-PSResource, Install-PSResource should work with all Nuget v3 repositories
Actual behavior
PS > Register-PSResourceRepository -Name pwshgallery -Uri "https://preview.pwsh.gallery/index.json" -ApiVersion V3
PS > Find-PSResource -Repository pwshgallery -Name az
Find-PSResource: TryConvertFromJson: Cannot parse PSResourceInfo from json object with error: The given key was not present in the dictionary
Error details
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.ConvertToPSResourceException
Message : TryConvertFromJson: Cannot parse PSResourceInfo from json object with error: The given key was not present in the dictionary.
HResult : -2146233088
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.FindHelper
CategoryInfo : ObjectNotFound: (Microsoft.PowerShel….Cmdlets.FindHelper:FindHelper) [Find-PSResource], ConvertToPSResourceException
FullyQualifiedErrorId : FindNameConvertToPSResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
InvocationInfo :
MyCommand : Find-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 16
Line : Find-PSResource -Repository pwshgallery -Name az
Statement : Find-PSResource -Repository pwshgallery -Name az
PositionMessage : At line:1 char:1
+ Find-PSResource -Repository pwshgallery -Name az
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Find-PSResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
0
1
Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.2.0 preview1 Microsoft.PowerShell.PSResourceGet {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}
Name Value
---- -----
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response