PoshCode / Metadata

Serialization for the PowerShell metadata format
MIT License
19 stars 2 forks source link

Square Bracket Indexing breaks PSCustomObject serialization #3

Closed vercellone closed 2 years ago

vercellone commented 2 years ago

1 8b5e3c48a9c37a581217afebbd857295867bb38e 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')
Jaykul commented 2 years ago

Published as 1.5.2

Jaykul commented 2 years ago

That's embarrassing. I reverted this fix when I fixed the new PSScriptAnalyzer rule.

Jaykul commented 2 years ago

Ok, this time for sure ... added please try 1.5.3 c845e45d2824fb0464ad774613c3fd519c50c8b7

vercellone commented 2 years ago

v1.5.3 is working. Thanks, again!