-
Notifications
You must be signed in to change notification settings - Fork 8.2k
GetParamBlock method of ProxyCommand fails #9058
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Steps to reproduce
[System.Management.Automation.ProxyCommand]::GetParamBlock((Get-Command Test-Connection))Expected behavior
Emits a param block.
Actual behavior
Exception calling "GetParamBlock" with "1" argument(s): "Object reference not set to an instance of an object."
At line:1 char:1
+ [System.Management.Automation.ProxyCommand]::GetParamBlock((Get-Comma ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException
Environment data
Name Value
---- -----
PSVersion 6.2.0-preview.3
PSEdition Core
GitCommitId 6.2.0-preview.3
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Description
The Test-Connection command uses the new ValidateRangeKind type to force a positive integer.
The GetProxyAttributeData method of ParameterMetadata cannot parse and generate a string to represent this attribute. It is the method responsible for raising the error shown above.
PowerShell/src/System.Management.Automation/engine/TypeMetadata.cs
Lines 908 to 927 in 1be3f4c
| ValidateRangeAttribute validRangeAttrib = attrib as ValidateRangeAttribute; | |
| if (validRangeAttrib != null) | |
| { | |
| Type rangeType = validRangeAttrib.MinRange.GetType(); | |
| string format; | |
| if (rangeType == typeof(float) || rangeType == typeof(double)) | |
| { | |
| format = ValidateRangeFloatFormat; | |
| } | |
| else | |
| { | |
| format = ValidateRangeFormat; | |
| } | |
| result = string.Format(CultureInfo.InvariantCulture, | |
| format, prefix, | |
| validRangeAttrib.MinRange, validRangeAttrib.MaxRange); | |
| return result; | |
| } |
PR
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime