PowerShell / PowerShell/PSResourceGet

Save-PSResource -AsNupkg causes pipeline input to fail

Open
#948 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Save Issue-Bug
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

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

Using -AsNupkg causes pipeline input to fail. Notice the error message name for the resource is the type name not resource.

Find-PSResource snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository -PassThru
Expected behavior
# works
Actual behavior
Find-PSResource snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository -PassThru
Save-PSResource: Package 'Microsoft.PowerShell.PowerShellGet.UtilClasses.PSResourceInfo' with requested version range '(, )' could not be found in any trusted repositories
Error details
Exception             :
    Type    : System.ArgumentException
    Message : Package 'Microsoft.PowerShell.PowerShellGet.UtilClasses.PSResourceInfo' with requested version range '(,
)' could not be found in any trusted repositories
    HResult : -2147024809
CategoryInfo          : ObjectNotFound: (:) [Save-PSResource], ArgumentException
FullyQualifiedErrorId : ResourceNotFoundError,Microsoft.PowerShell.PowerShellGet.Cmdlets.SavePSResource
InvocationInfo        :
    MyCommand        : Save-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 24
    HistoryId        : 13
    Line             : Find-PSResource snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository -PassThru
    PositionMessage  : At line:1 char:24
                       + … urce snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository - …
                       +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Save-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Environment data
3.0.19

Name                           Value
----                           -----
PSVersion                      7.3.2
PSEdition                      Core
GitCommitId                    7.3.2
OS                             Microsoft Windows 10.0.19044
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the pipeline command using Find-PSResource and Save-PSResource with -AsNupkg and -PassThru. Trace the Save-PSResource pipeline-input path and the ResourceNotFoundError construction; done means the piped PSResourceInfo is saved successfully and the error, if triggered, identifies the actual resource rather than its type name.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.