Skip to content

Export-Csv / ConvertTo-Csv: Stringification of array-valued property values depends on whether they happen to be [psobject]-wrapped #20450

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

Note:

& {
  [psobject]::new() | Select-Object @{Name = "Groups"; Expression = { 'a', 'b', 'c' } } 
  [pscustomobject] @{ Groups = 'a', 'b', 'c' }
} | ConvertTo-Csv

Expected behavior

"Groups"
"a b c"
"a b c"

Actual behavior

"Groups"
"a b c"
"System.Object[]"

That is, without the incidental [psobject] wrapper, simple .ToString() stringification was applied.

Error details

No response

Environment data

PowerShell 7.4.0-preview.6

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions