Skip to content

Square Bracket Indexing breaks PSCustomObject serialization #3

@vercellone

Description

@vercellone

#1 8b5e3c4 breaks PSCustomObject serialization.

Expected PSObject property values are intact when serialized.
Actual PSObject property values are all empty strings when serialized.

# requires -Modules Metadata
$PSVersionTable | Select-Object *
Get-Module -Name Metadata
Get-ChildItem -File | Select-Object FullName, *Utc, Length | ConvertTo-Metadata

# Results....
#
# SerializationVersion      : 1.1.0.1
# WSManStackVersion         : 3.0
# PSCompatibleVersions      : {1.0, 2.0, 3.0, 4.0…}
# GitCommitId               : 7.2.0
# OS                        : Microsoft Windows 10.0.19043
# Platform                  : Win32NT
# PSEdition                 : Core
# PSVersion                 : 7.2.0
# PSRemotingProtocolVersion : 2.3
#
# ModuleType Version    PreRelease Name                                ExportedCommands
# ---------- -------    ---------- ----                                ----------------
# Script     1.5.1                 Metadata                            {Add-MetadataConverter, ConvertFrom-Metadata, ConvertTo-Metadata, Export-Metadata…}
#
# (PSObject @{
#   CreationTimeUtc = ""
#   FullName = ""
#   LastAccessTimeUtc = ""
#   LastWriteTimeUtc = ""
#   Length = ""
# } -TypeName 'Selected.System.IO.FileInfo','System.Management.Automation.PSCustomObject','System.Object')
# (PSObject @{
#   CreationTimeUtc = ""
#   FullName = ""
#   LastAccessTimeUtc = ""
#   LastWriteTimeUtc = ""
#   Length = ""
# } -TypeName 'Selected.System.IO.FileInfo','System.Management.Automation.PSCustomObject','System.Object')
# (PSObject @{
#   CreationTimeUtc = ""
#   FullName = ""
#   LastAccessTimeUtc = ""
#   LastWriteTimeUtc = ""
#   Length = ""
# } -TypeName 'Selected.System.IO.FileInfo','System.Management.Automation.PSCustomObject','System.Object')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions