You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Group-Object fails with a NullReferenceException on empty noteproperty #3300
PS C:\Users\slee>$x=1|Select-Object-Property @{Name='X'; Expression= {}}
PS C:\Users\slee>$x|Group-Object X
Expected
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.GroupObjectCommand
Workaround
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=}}
Activity