PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

`Update-PSModuleManifest` is destroying nested hashtables in `PrivateData`

Open briantist opened this issue 6 months ago • 1 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

Running Update-PSModuleManifest on a manifest with nested hashtables in PrivateData is replacing the hashtables with the string representation System.Collections.Hashtable.

For example, with:

PrivateData = @{

	MemberA = @{
		One = 'one'
		Two = 'two'
	}

	PSData = @{

            ExternalModuleDependencies = @(
                'AWSPowerShell'
            )

    } # End of PSData hashtable

} # End of PrivateData hashtable

Running Update-PSModuleManifest with any value (even something that doesn't affect PSData like ModuleVersion, the resulting PrivateData will have non-PSData members replaced:

PrivateData = @{

    PSData = @{

        # Tags applied to this module. These help with module discovery in online galleries.
        # Tags = @()

        # A URL to the license for this module.
        # LicenseUri = ''

        # A URL to the main website for this project.
        # ProjectUri = ''

        # A URL to an icon representing this module.
        # IconUri = ''

        # ReleaseNotes of this module
        # ReleaseNotes = ''

        # Prerelease string of this module
        # Prerelease = ''

        # Flag to indicate whether the module requires explicit user acceptance for install/update/save
        # RequireLicenseAcceptance = $false

        # External dependent modules of this module
        ExternalModuleDependencies = 'AWSPowerShell'

    } # End of PSData hashtable


    # MemberA
    MamberA = 'System.Collections.Hashtable'

} # End of PrivateData hashtable

Expected behavior

The original hashtable members of `PrivateData` are preserved.

Actual behavior

The original hashtable members of `PrivateData` are replaced with the single string `'System.Collections.Hashtable'`.

Error details

No response

Environment data

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


Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Ubuntu 22.04.4 LTS
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


### Visuals

_No response_

briantist avatar Feb 24 '24 22:02 briantist

Thanks @briantist we hoped this was fixed in the last release but will try to repro

SydneyhSmith avatar Feb 26 '24 19:02 SydneyhSmith