Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix a bug in how Write-Host handles XML Elements#24669

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
daxian-dbw merged 4 commits intoPowerShell:masterfrombrendandburns:master
Dec 13, 2024

Conversation

brendandburns
Copy link
Contributor

PR Summary

Changes how theWrite-Host cmdlet handles XMLElements,fixes#24508

PR Context

I'm not positive this is the right fix, spiritually I could get behind using.OuterXml instead which would print the whole XML document from that element, which seems aligned with the iteration of an Enumerable.

Either way, it is definitely the case that the current code doesn't work as expected.

PR Checklist

mklement0 reacted with thumbs up emoji
@brendandburns
Copy link
ContributorAuthor

brendandburns commentedDec 12, 2024
edited
Loading

Let me know if you want me to update unit tests for this case.

Added a unit test.

@brendandburns
Copy link
ContributorAuthor

Another option would be to returnenumerable.ToString() if theenumerable has zero elements in it (the case withXMLText) but that printsSystem.Xml.XmlText which I don't really think is the right output forWrite-Host ([xml] '<OhElement>Where art thou?</OhElement>').DocumentElement

brendandburnsand others added2 commitsDecember 13, 2024 07:06
…teConsoleCmdlet.csCo-authored-by: Dongbo Wang <dongbow@microsoft.com>
…t.Tests.ps1Co-authored-by: Steve Lee <slee@microsoft.com>
@daxian-dbwdaxian-dbw merged commit90b0149 intoPowerShell:masterDec 13, 2024
37 checks passed
@jshigetomijshigetomi added the CL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change Log labelJan 14, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@SteveL-MSFTSteveL-MSFTSteveL-MSFT left review comments

@daxian-dbwdaxian-dbwdaxian-dbw approved these changes

@iSazonoviSazonoviSazonov approved these changes

Assignees
No one assigned
Labels
CL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Write-Host renders an[xml] or[XmlElement] instance as an empty line.
5 participants
@brendandburns@daxian-dbw@SteveL-MSFT@iSazonov@jshigetomi

[8]ページ先頭

©2009-2025 Movatter.jp