Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Write-Host renders IDictionary inconsistently depending on if the value is piped in #24671

Copy link
Copy link
@daxian-dbw

Description

@daxian-dbw
Issue body actions

Prerequisites

Steps to reproduce

Write-Host renders an instance of Dictionary inconsistently depending on how the value is passed in: Write-Host $d vs. $d | Write-Host.

$d = [System.Collections.Generic.Dictionary[string,string]]::new()
$d.Add('abc', 'def')
$d.Add('hhh', 'nnn')

Write-Host $d
> [abc, def] [hhh, nnn]

$d | Write-Host
> System.Collections.Generic.Dictionary`2[System.String,System.String]

Expected behavior

The rendering result should be consistent.

Actual behavior

## Not consistent.

Write-Host $d
> [abc, def] [hhh, nnn]

$d | Write-Host
> System.Collections.Generic.Dictionary`2[System.String,System.String]

Error details

N/A

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.