PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
479 stars 90 forks source link

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

Open briantist opened 5 months ago

briantist commented 5 months ago

Prerequisites

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_
SydneyhSmith commented 5 months ago

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