Powershell: Select-Object default output formatting is situationally broken

Created on 10 Oct 2019  路  4Comments  路  Source: PowerShell/PowerShell

The test command below _should_ yield:

Length
------
     3

but currently yields:

@{Length=3}

The problem may be specific to [string] input (a rare scenario) - not sure what the underlying pattern is.

Steps to reproduce

'one' | Select-Object Length | Out-String | Should -not -match '@'

Expected behavior

The test should pass.

Actual behavior

The test fails.

Expected regular expression '@' to not match '@{Length=3}
', but it did match.

Environment data

PowerShell Core 7.0.0-preview.4
Area-Cmdlets-Utility Issue-Bug Resolution-Fixed

All 4 comments

This is a regression from WinPS5.1

 'one' | Select-Object Length

Length
------
     3

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Ok, that narrows it down a bit.

:tada:This issue was addressed in #10765, which has now been successfully released as v7.0.0-preview.5.:tada:

Handy links:

Was this page helpful?
0 / 5 - 0 ratings