-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
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
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.