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.
|
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
#9059
Steps to reproduce
Expected behavior
Emits a param block.
Actual behavior
Environment data
Description
The
Test-Connectioncommand 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
PR
#9059