Prerequisites
Steps to reproduce
1.) Have a JSON with multiple keys in an object
2.) Convert to pwsh objects by using ConvertFrom-Json -AsHashtable
A random order appears even on pwsh 7.3+
Expected behavior
The ordering should be the same always
Actual behavior
Random order appears on subsequent runs
Error details
N/A - Crashes Pester Tests as Expected doesn't match half of the time
Environment data
Image: mcr.microsoft.com/dotnet/sdk:9.0
PS /> $PSVersionTable
Name Value
---- -----
PSVersion 7.5.2
PSEdition Core
GitCommitId 7.5.2
OS Debian GNU/Linux 12 (bookworm)
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
On two different runs of the tests (dumping out the object converted back to JSON):
One can see it's an OrderedHashtable but the ordering within it is totally random...
One run:
Name Value
---- -----
aws:SourceAccount <ID>
aws:SourceArn <ARN>
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False OrderedHashtable System.Collections.H…
Another run:
Name Value
---- -----
aws:SourceArn <ARN>
aws:SourceAccount <ID>
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False OrderedHashtable System.Collections.H…
Since 7.3+ this should be a properly ordered Hashtable with a determined order:
Issue: #17404
PR: #17405
Prerequisites
Steps to reproduce
1.) Have a JSON with multiple keys in an object
2.) Convert to pwsh objects by using
ConvertFrom-Json -AsHashtableA random order appears even on pwsh 7.3+
Expected behavior
The ordering should be the same alwaysActual behavior
Random order appears on subsequent runsError details
N/A - Crashes Pester Tests as Expected doesn't match half of the timeEnvironment data
Visuals
On two different runs of the tests (dumping out the object converted back to JSON):
One can see it's an OrderedHashtable but the ordering within it is totally random...
One run:
Another run:
Since 7.3+ this should be a properly ordered Hashtable with a determined order:
Issue: #17404
PR: #17405