Steps to reproduce
Paste into console (Error record arguments don't matter):
[CmdletBinding()] param() end {
$PSCmdlet.WriteError([Management.Automation.ErrorRecord]::new([Exception]::new(), '', 0, '')) }
Expected behavior
Exception of type 'System.Exception' was thrown.
Actual behavior
Nothing is shown. When calling $Error[0], this is shown:
Get-Command:
Line |
201 | … if ($myinv.MyCommand -and (Get-Command -Name $myinv.MyCommand -ErrorA …
| ~~~~~~~~~~~~~~~~
| Cannot validate argument on parameter 'Name'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.
Stringification probably shouldn't be relied on here, and $myinv.MyCommand.Name should be used instead.
Environment data
Name Value
---- -----
PSVersion 7.1.0-preview.2
PSEdition Core
GitCommitId 7.1.0-preview.2
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Steps to reproduce
Paste into console (Error record arguments don't matter):
Expected behavior
Actual behavior
Nothing is shown. When calling
$Error[0], this is shown:Stringification probably shouldn't be relied on here, and
$myinv.MyCommand.Nameshould be used instead.Environment data