PowerShell / PowerShell/PSResourceGet

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

Open
#1,574 4 comments 0 reactions 1 assignee View on GitHub

@anamnavi is already working on this.

Since Feb 26, 2024.

Area-InfoFile 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

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_

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.