See
|
/// <summary> |
|
/// Gets or sets the Depth property. |
|
/// </summary> |
|
[Parameter] |
|
[ValidateRange(0, int.MaxValue)] |
|
public int Depth |
|
{ |
|
get { return _depth; } |
|
set { _depth = value; } |
|
} |
/// <summary>
/// Gets or sets the Depth property.
/// </summary>
[Parameter]
[ValidateRange(0, int.MaxValue)]
public int Depth
{
get { return _depth; }
set { _depth = value; }
}
The valid range should be 0 to 100, not int.MaxValue.
Steps to reproduce
PS C:\Git> dir | ConvertTo-Json -Depth 1000
ConvertTo-Json: The maximum depth allowed for serialization is 100.
Expected behavior
The error should come from parameter validation, not from BeginProcessing().
Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
See
PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
Lines 34 to 43 in a95b2cb
The valid range should be 0 to 100, not int.MaxValue.
Steps to reproduce
Expected behavior
The error should come from parameter validation, not from
BeginProcessing().Environment data