Skip to content

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

Description

@TylerLeonhardt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions