Skip to content

ConvertTo-Clixml and Export-CliXml inappropriately decorate their input objects with NoteProperty members introduced for serialization #25854

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

Write-Error foo 2>$null
$e = $Error[0]

$e | Get-Member -View Extended | Out-Host

'---'

# !! The unexpected decoration happens here.
# !! Ditto with Export-CliXml
$null = $e | ConvertTo-CliXml

$e | Get-Member -View Extended | Out-Host

Expected behavior

Both Get-Member calls should yield the same output.

Actual behavior

The second Get-Member call reveals many additional NoteProperty members, such as ErrorCategory_Activity.

These members are properties created for serializing ErrorRecord instances, but attaching them to the input objects is inappropriate.

Error details

Environment data

PowerShell 7.6.0-preview.4 (goes back to WinPS)

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility moduleWG-ReviewedA Working Group has reviewed this and made a recommendation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Reviewed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions