-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Group-Object fails with a NullReferenceException on empty noteproperty #3300
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Repro:
PS C:\Users\slee> $x = 1 | Select-Object -Property @{Name = 'X'; Expression = {}}
PS C:\Users\slee> $x | Group-Object XExpected
Count Name Group
----- ---- -----
1 {@{X=}}Actual
Group-Object : Object reference not set to an instance of an object.
At line:1 char:6
+ $x | Group-Object X
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Group-Object], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GroupObjectCommandWorkaround
PS C:\Users\slee> $x = 1 | Select-Object -Property @{Name = 'X'; Expression = {$null}}
PS C:\Users\slee> $x | Group-Object X
Count Name Group
----- ---- -----
1 {@{X=}}TFS:10939589
PSVersionTable
PS C:\Users\slee> $psversiontable
Name Value
---- -----
GitCommitId v6.0.0-alpha.17
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
CLRVersion
SerializationVersion 1.1.0.1
PSEdition Core
BuildVersion 3.0.0.0
PSVersion 6.0.0-alpha
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime