Skip to content

Update-PSModuleManifest is destroying nested hashtables in PrivateData #1574

Open
@briantist

Description

@briantist

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

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_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions