Get-ParameterInfo on commands with -Count Parameters Errors
ninmonkey opened this issue · comments
Jake Bolton commented
Describe the bug
Get-ParameterInfo
on any command with a -count
parameter triggers an exception:
Cannot compare "System.Management.Automation.ParameterMetadata" because it is not IComparable.
To Reproduce
Get-Command 'Get-Random' | Get-ParameterInfo
PS> Get-Command Get-Random | Get-ParameterInfo
InvalidOperation: C:\Users\...\PSScriptTools\2.38.0\functions\Get-Parameter.ps1:58
Line |
58 | if ($data.count -gt 0) {
| ~~~~~~~~~~~~~~~~~
| Cannot compare "System.Management.Automation.ParameterMetadata" because it is not IComparable.
Expected behavior
Not throw when elements have the parameter.
Environment
Windows10
PS> $PSVersionTable | Select-Object -prop PSVersion, GitCommitId, OS, PSEdition
PSVersion GitCommitId OS PSEdition
--------- ----------- -- ---------
7.1.4 7.1.4 Microsoft Windows 10.0.19043 Core
PS> Get-Module PSScriptTools
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 2.38.0 PSScriptTools