Skip to content
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

Write-Output -NoEnumerate should not convert items in list to PSObject #8124

Closed
TylerLeonhardt opened this issue Oct 25, 2018 · 2 comments
Closed
Labels
Resolution-Duplicate The issue is a duplicate.

Comments

@TylerLeonhardt
Copy link
Member

Steps to reproduce

→ [int[]] $before = @(1,2,3,4)

→ $before.GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     Int32[]                                  System.Array

→ $after = Write-Output $before -NoEnumerate

→ $after.GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     PSObject[]                               System.Array

Expected behavior

$after's type should still be Int32[] because Write-Output -NoEnumerate should not mess with the contents of the array.

Actual behavior

$after's type is PSObject[]

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Darwin 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:59:21 PDT 2018; root:xnu-4903.201.2~4/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@mklement0
Copy link
Contributor

mklement0 commented Oct 26, 2018

Indeed, but this has been reported before: #5955

In fact, there's a few related issues: https://github.com/PowerShell/PowerShell/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+Write-Output+-NoEnumerate+in%3Atitle

All of which seem to originate in this ill-fated PR: #2038, originally discussed in #2035.

@iSazonov iSazonov added the Resolution-Duplicate The issue is a duplicate. label Oct 26, 2018
@TylerLeonhardt
Copy link
Member Author

Sounds good. I'll resolve as dupe to #5955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate The issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants