-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Get-Command fails with unexpected error when given a blank command-name argument #13342
Copy link
Copy link
Closed
Labels
First-Time-IssueEasy issues first time contributors can work on to learn about this projectEasy issues first time contributors can work on to learn about this projectIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
Metadata
Metadata
Assignees
Labels
First-Time-IssueEasy issues first time contributors can work on to learn about this projectEasy issues first time contributors can work on to learn about this projectIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
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