Enable Write-Information to accept $null (#8774)

This commit is contained in:
Steve Lee
2019-01-31 13:16:34 -08:00
committed by Andrew
parent 5c8a5f355e
commit 313c8c06a1
2 changed files with 8 additions and 0 deletions
@@ -165,6 +165,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true)]
[Alias("Msg", "Message")]
[AllowNull]
public object MessageData { get; set; }
/// <summary>
@@ -114,5 +114,12 @@ Describe "Stream writer tests" -Tags "CI" {
$result.Count | Should -Be $returnCount
(Compare-Object $result $returnValue -SyncWindow 0).length | Should -Be 0
}
It "Write-Information accepts `$Null" {
$streamPath = Join-Path $testdrive information.txt
$null | Write-Information -Tags myTag -ErrorAction Stop -InformationAction SilentlyContinue -InformationVariable i
$i.Tags | Should -BeExactly "myTag"
$i.MessageData | Should -Be $null
}
}
}