Skip to content

PSResourceGet v1.1.1 not working with Nuget.Server v3.4.2 #1896

@realslacker

Description

@realslacker

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 have compiled and deployed Nuget.Server per Microsoft documentation. With the latest PSResourceGet I have registered a PSResourceRepository with the following parameters.

Register-PSResourceRepository -Name psrepo -Uri https://psrepo/nuget -Trusted -ApiVersion NugetServer

Calling Find-PSResource fails with the following:

PS> Find-PSResource -Name ExistingModule -Repository psrepo
DEBUG: In FindPSResource::ProcessResourceNameParameterSet()
DEBUG: Filtering package name(s) on wildcards
DEBUG: In FindHelper::FindByResourceName()
DEBUG: Parameters passed in >>> Name: 'E7ADSitePlan'; ResourceType: 'None'; VersionRange: ''; NuGetVersion: ''; VersionType: 'NoVersion'; Version: ''; Prerelease: 'False'; Tag: ''; Repository: 'psrepo'; IncludeDependencies 'False'
DEBUG: Searching through repository 'psrepo'
DEBUG: In FindHelper::SearchByNames()
DEBUG: No version specified, package name is specified
DEBUG: In NuGetServerAPICalls::FindName()
DEBUG: In NuGetServerAPICalls::HttpRequestCall()
DEBUG: Request url is: 'https://psrepo/nuget/FindPackagesById()?%24filter=IsLatestVersion+and+Id+eq+%27ExistingModule%27&id=%27ExistingModule%27'
Find-PSResource: TryConvertFromXml: Cannot parse PSResourceInfo from XmlNode with error: Object reference not set to an instance of an object.

Note that calling the API endpoint directly does return a response.

PS> Invoke-RestMethod 'https://psrepo/nuget/FindPackagesById()?%24filter=IsLatestVersion+and+Id+eq+%27ExistingModule%27&id=%27ExistingModule%27'

id         : https://psrepo/nuget/Packages(Id='ExistingModule',Version='1.1.1.1')
category   : category
link       : {link, link}
title      : title
published  : 2025-10-08T17:12:59Z
updated    : 2025-10-08T17:12:59Z
author     : author
action     : action
content    : content
properties : properties

Additionally of note is that the search function appears to erroneously include the Module name in the version query parameter if version is specified...

PS> Find-PSResource -Name ExampleModule -Version '1.1.1.1' -Repository psrepo
DEBUG: In FindPSResource::ProcessResourceNameParameterSet()
DEBUG: Filtering package name(s) on wildcards
DEBUG: Parsing package version
DEBUG: In FindHelper::FindByResourceName()
DEBUG: Parameters passed in >>> Name: 'ExampleModule'; ResourceType: 'None'; VersionRange: ''; NuGetVersion: '1.1.1.1'; VersionType: 'SpecificVersion'; Version: '1.1.1.1'; Prerelease: 'False'; Tag: ''; Repository: 'psrepo'; IncludeDependencies 'False'
DEBUG: Searching through repository 'psrepo'
DEBUG: In FindHelper::SearchByNames()
DEBUG: Exact version and package name are specified
DEBUG: In NuGetServerAPICalls::FindVersion()
DEBUG: In NuGetServerAPICalls::HttpRequestCall()
DEBUG: Request url is: 'https://psrepo/nuget/FindPackagesById()?%24filter=Id+eq+%27ExampleModule%27+and+NormalizedVersion+eq+%27ExampleModule%27&id=%27ExampleModule%27'
Find-PSResource: Package does not exist on the server

In the request url you can see NormalizedVersion eq "ExampleModule" is present in the url.

Expected behavior

Searches succeed

Actual behavior

See above

Error details

Find-PSResource: TryConvertFromXml: Cannot parse PSResourceInfo from XmlNode with error: Object reference not set to an instance of an object.

Environment data

PS> Get-Module  Microsoft.PowerShell.PSResourceGet; $PSVersionTable | Format-Table

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.1.1                 Microsoft.PowerShell.PSResourceGet  {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}


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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions