GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Enable `Write-Information` to accept $null by SteveL-MSFT · Pull Request #8774 · PowerShell/PowerShell

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Jan 29, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Summary

Write-Information currently errors if $null is passed.

PR Context

There's no benefit to having it error out if $null is passed. If a pipeline is sending objects to Write-Information, it would make sense for the cmdlet to handle $null which in this case is a no-op.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] to your commit messages if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT
enable write-information to accept $null
be9d401
@SteveL-MSFT Steve Lee (SteveL-MSFT) assigned Andrew (anmenaga) Jan 29, 2019
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested a review from Andrew (anmenaga) January 29, 2019 01:21
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested review from James Truher (JamesWTruher) and Paul Higinbotham (PaulHigin) as code owners January 29, 2019 01:21
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Jan 29, 2019

Copy link
Copy Markdown
Member Author

The codefactor issue is in existing code that wasn't changed and also complaining about Hungarian notation which it isn't.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rjmholt
Rob Holt (rjmholt) reviewed Jan 29, 2019
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 Outdated
}

It "Write-Information accespts `$Null" {
$null | Write-Information | Should -BeNullOrEmpty

@rjmholt Rob Holt (rjmholt) Jan 29, 2019

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than "NullOrEmpty", we should probably be specific about what this case does, and test it by checking the information stream for the result if possible.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov and vexx32 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Jan 29, 2019

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you're proposing to check here. Previously it was returning a non-terminating error. I can change it to stop on error which would cause the test to fail without this change. The OrEmpty of the assertion only applies if the input is a string anyways.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Jan 29, 2019

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write-Information doesn't write to pipeline so the test is misleading. It is more clear to check Information stream contains $null or check -NotThrow.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Jan 29, 2019

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see what you guys are saying now. Will make a change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iSazonov
Ilya (iSazonov) reviewed Jan 29, 2019
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
fix typo, change test to fail on error if behavior reverted
b9e1274
PaulHigin
Paul Higinbotham (PaulHigin) approved these changes Jan 29, 2019
View reviewed changes
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Jan 29, 2019

Copy link
Copy Markdown
Member Author

The codefactor issue is wrong

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
address Rob's feedback
88e91d0
@anmenaga

Andrew (anmenaga) commented Jan 29, 2019

Copy link
Copy Markdown

Rob Holt (@rjmholt) Ilya (@iSazonov) Plase review this PR again when you get a chance. Thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vexx32
Rain Sallow (/u/ta11ow) (vexx32) reviewed Jan 29, 2019
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) approved these changes Jan 30, 2019
View reviewed changes
rjmholt
Rob Holt (rjmholt) reviewed Jan 30, 2019
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
address Rob's feedback
cc448fa
rjmholt
Rob Holt (rjmholt) approved these changes Jan 31, 2019
View reviewed changes
@anmenaga
Andrew (anmenaga) merged commit 313c8c0 into PowerShell:master Jan 31, 2019
@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Feb 1, 2019
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the null-write-information branch June 6, 2020 02:29
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SteveL-MSFT Andrew
Enable Write-Information to accept $null (PowerShell#8774)
a6cee04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov approved these changes
@anmenaga Andrew (anmenaga) Awaiting requested review from anmenaga
@JamesWTruher James Truher (JamesWTruher) Awaiting requested review from JamesWTruher
+3 more reviewers
@vexx32 Rain Sallow (/u/ta11ow) (vexx32) vexx32 left review comments
@rjmholt Rob Holt (rjmholt) rjmholt approved these changes
@PaulHigin Paul Higinbotham (PaulHigin) PaulHigin approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@anmenaga Andrew (anmenaga)

Labels

CL-General Indicates 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.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@SteveL-MSFT @anmenaga @rjmholt @PaulHigin @iSazonov @vexx32
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.