-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.The issue won't be fixed, possibly due to compatibility reason.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
Steps to reproduce
# Create a nested object
$end = 101
$start = 1
$previous = @{
Depth = $end
Next = $null
}
($end-1)..$start | % {
$current = @{
Depth = $_
Next = $previous
}
$previous = $current
}
$previous | ConvertTo-Json -Depth $end
Expected behavior
PowerShell is able to dynamically check if we are running out of stack, and serialize objects with bigger depths.
Actual behavior
ConvertTo-Json : The maximum depth allowed for serialization is 100.
At line:1 char:13
+ $previous | ConvertTo-Json -Depth $end
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [ConvertTo-Json], InvalidOperationException
+ FullyQualifiedErrorId : ReachedMaximumDepthAllowed,Microsoft.PowerShell.Commands.ConvertToJsonCommand
Environment data
> $PSVersionTable
PS C:\windows\system32> $PSVersionTable
Name Value
---- -----
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.3
PSComp
6B11
atibleVersions {1.0, 2.0, 3.0, 4.0...}
GitCommitId v6.0.0-alpha.13-139-g152de408523eef294ab8592dd7740dd86c93313f
CLRVersion
PSVersion 6.0.0-alpha
PSEdition Core
BuildVersion 3.0.0.0
chrisalbrecht, bittusarkar, LockTar, felixfbecker, mklement0 and 1 more
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.The issue won't be fixed, possibly due to compatibility reason.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module