-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Closed
Copy link
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
Steps to reproduce
There are several variations of the issue when using a boolean along side a number:
Example 1 - Boolean gets classified as an int32 but separated from other ints in an array
$true, 2, 123 | Format-HexLabel: Int32 (System.Int32) <5692E06D>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 01 00 00 00 ?
Label: Int32 (System.Int32) <0ABB4E98>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 02 00 00 00 7B 00 00 00 ? {
Example 2 - '123' is labeled and output as a boolean and $true is grouped in the ints
123,$true,2,123 | Format-HexLabel: Boolean (System.Boolean) <5437D5CB>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 7B 00 00 00 {
Label: Int32 (System.Int32) <23FB0F32>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 01 00 00 00 02 00 00 00 7B 00 00 00 ? ? {
Example 3 - Processes the first object in the pipe correctly and throws and error for the second. This is true whether the Boolean is first or second in the array.
123,$true | Format-HexLabel: Boolean (System.Boolean) <16312C72>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 7B 00 00 00 {
Format-Hex: Object reference not set to an instance of an object.
Example 4 - Showing the Boolean doesn't have to be $True. Similar to Example 2
123,$false,2,123 | Format-HexLabel: Boolean (System.Boolean) <4A512B9F>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 7B 00 00 00 {
Label: Int32 (System.Int32) <4B76B7B6>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 00 00 00 00 02 00 00 00 7B 00 00 00 ? {
Expected behavior
# Should not throw an error and correctly label and group objects
$true, 123 | Format-HexLabel: Boolean (System.Boolean) <5437D5CB>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 01 00 00 00 ?
Label: Int32 (System.Int32) <23FB0F32>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 7B 00 00 00 {
# Group label and group objects correctly
$true,2,123 | Format-HexLabel: Boolean (System.Boolean) <5437D5CB>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 01 00 00 00 ?
Label: Int32 (System.Int32) <0ABB4E98>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 02 00 00 00 7B 00 00 00 ? {
Actual behavior
Environment data
Name Value
---- -----
PSVersion 7.0.0-rc.1
PSEdition Core
GitCommitId 7.0.0-rc.1
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module