New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ConvertTo-Json detect circular references #6638
Comments
Default values is private int _depth = 2;
private const int maxDepthAllowed = 100; Is maxDepthAllowed value good protection? |
.Net Core 3.1 and later support this. I hope we will resolve issue after moving to .Net Core 5.0. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
1 similar comment
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
The current way to deal with circular references is the
Depth
parameter. Its default value is too low and increasing it doesn't address a usual use case where the object is deep and doesn't contain any circular reference.Add a
CircularDetection
switch parameter.Once a circular reference is detected, throw an exception. If the switch is not present, cap the object by the depth limit.
Currently no exception is thrown when the depth limit is reached. This easily propagates the error and may remain undetected until the collected data is evaluated. One option to consider is to make the detection default. The switch can be changed to
-DisableCircularDetection
which enables the current behavior. This is a breaking change for some users.Unaffected groups of users:
Depth
parameter.Affected groups of users:
The text was updated successfully, but these errors were encountered: