-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pscustomobject] type accelerator does not work in 7.4.0 #20719
Comments
that's pretty strange, your example works for me on 7.4.0. Could you try and temporarily disable PS > [pscustomobject]@{one = 1; two = 2 }
one two
--- ---
1 2
PS > ([pscustomobject]@{one = 1; two = 2 }).Gettype().Name
PSCustomObject
PS > ([pscustomobject]@{one = 1; two = 2 }).One.Gettype().Name
Int32
PS > $ht = @{}
PS > $ht.add('one',1)
PS > $ht.add('two',2)
PS > [PSCustomObject]$ht
two one
--- ---
2 1
PS > $PSVersionTable
Name Value
---- -----
PSVersion 7.4.0
PSEdition Core
GitCommitId 7.4.0
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
|
It does just work for me:
Shows:
|
Also check how (in what way) you did install pwsh 7.4:
|
It works for me as well; do you get anything if you run this, to see if there is an output and it's just being hidden on your terminal somehow: PS> $x = [pscustomobject]@{one=1; two=2}
PS> $x | Get-Member Or these, to check if the type accelerator is working? PS C:\> [pscustomobject]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSObject System.Object
PS C:\> [pscustomobject].FullName
System.Management.Automation.PSObject
PS C:\> [System.Management.Automation.PSCustomObject]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSCustomObject System.Object |
yeah, that's a weird issue. The OS on the affected PC is freshly installed from ISO a week ago. I downloaded x64 ZIP versions 7.4.0 and 7.3.10 to test without installation - results are: I have a workaround for this problem for me - I will just use a different PC/VM for executing scripts using [pscustomobject] type accelerator. |
I can confirm the same issue with Constrained Language Audit Mode breaking [pscustomobject] |
Update: See next comment. @shivtorov, note that |
Prerequisites
Steps to reproduce
Expected results: a new object created
Actual results: nothing = no new object, no errors, no hashtable
Expected behavior
Actual behavior
PS> [pscustomobject]@{one=1; two=2}
Error details
No response
Environment data
Visuals
The text was updated successfully, but these errors were encountered: