-
Notifications
You must be signed in to change notification settings - Fork 636
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
DYN-6468 Add Guard for circular references that can impact Stringify.JSON and Remember node #14651
Conversation
} | ||
}; | ||
|
||
StringBuilder sb = new StringBuilder(256); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this capacity chosen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied what was in the internal implementation for Json.Net for JsonConvert.SerializeObject
which looks like the new code but without the overridden JsonTextWriter
}; | ||
|
||
StringBuilder sb = new StringBuilder(256); | ||
using (var writer = new StringWriter(sb, CultureInfo.InvariantCulture)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does json.net usually use invariant culture to serialize strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently... Again just duplicated the implementation.
private readonly int maxDepth = 15; | ||
private int depth = 0; | ||
|
||
public MaxDepthJsonTextWriter(TextWriter writer) : base(writer) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe allow setting the depth in the constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it that way but simplified it since we aren't using this anywhere else currently. Right now one place to set it.
regression test would be good. |
Purpose
In testing the Remember node we found that some classes of NET objects can cause Dynamo Crashes when Stringify.JSON tries to serialize the objects to JSON via json.net. The main example cases were some types of Revit objects. While it is expected that these objects should not serialize to json. They should fail with a warning on the node and not a hard crash.
Todo
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
(FILL ME IN) Brief description of the fix / enhancement. Mandatory section
Reviewers
@mjkkirschner
FYIs
@jnealb