Note: This is definitely a minor bug that won't arise too often in the real world.
Passing an all-whitespace -Name argument to Get-Command results in unexpected error message Get-Command: Index was outside the bounds of the array.
Steps to reproduce
{ Get-Command -ea Stop -Name ' ' } | Should -Throw -ErrorId CommandNotFoundException
Expected behavior
The test should succeed; that is, the usual CommandNotFoundException should be reported.
Actual behavior
The test fails, because the error mentioned above is reported instead.
Expected an exception, with FullyQualifiedErrorId 'CommandNotFoundException' to be thrown,
but the FullyQualifiedErrorId was
'System.IndexOutOfRangeException,Microsoft.PowerShell.Commands.GetCommandCommand'
Environment data
PowerShell Core 7.1.0-preview.5
Note: This is definitely a minor bug that won't arise too often in the real world.
Passing an all-whitespace
-Nameargument toGet-Commandresults in unexpected error messageGet-Command: Index was outside the bounds of the array.Steps to reproduce
{ Get-Command -ea Stop -Name ' ' } | Should -Throw -ErrorId CommandNotFoundExceptionExpected behavior
The test should succeed; that is, the usual
CommandNotFoundExceptionshould be reported.Actual behavior
The test fails, because the error mentioned above is reported instead.
Environment data