-
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
Dropdown Value Xml Escaping and unescaping Exception #9447
Conversation
can you give some more background on this? Do we xml escape strings that we save as json? Why does invalid xml break json deserialization? |
@mjkkirschner This is actually not part of Json deserialization, this expose a problem underneath that the undo, redo, update value commands are still using XML format. So executing these command still going through the XML code. I am not sure why we escape charters in this case, need to check with @sm6srw why he added this guard in the first place. |
okay gotcha, it's a large refactor to remove this code, but it should be done eventually as of now we have to maintain double the serialization logic. |
@mjkkirschner Yes, if we removed the XML serialization/ deserialization code and finished the refactor on time, we should not need this fix at all. But it is what it is. |
Update to use native .Net functions instead of XML reader/writer for string with Xml special char escaping and unescaping. Unit tests added and passing. Self CI passed in https://master-15.jenkins.autodesk.com/view/DYN/job/DYN-DevCI_Self_Service/176/ |
Ping |
@mjkkirschner @aparajit-pratap Comments addressed which does not affect newly added unit tests |
LGTM - do we need any updated tests in d4r @ZiyunShang @QilongTang ? |
@mjkkirschner With this implementation, D4R code and tests can stay as its current state. I would like to run D4R self CI though @ZiyunShang @AndyDu1985 😉 |
@QilongTang do you want to wait to merge this until the tests are run on the revit side? |
@mjkkirschner I think the unit tests in DynamoCore are sufficient. I did not have time to make a final testing on Revit side before merging this. |
@mjkkirschner @aparajit-pratap @smangarole Added a gif for local testing results, merging |
* DropdownValueXmlParsing * Use .Net methods for escape and unescape * Add Unit Tests * Update to use WebUtility.HtmlDecode and add unit tests * Address Comments
Please Note:
DynamoRevit
repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after aLGTM
label is added to the PR.Purpose
DYN-1195
Dropdown nodes can fail to maintain previous selection in Dynamo Player.
This PR fixes an edge case that when parsing selection which contains special characters in XML doc like &, <, >, etc, our code failed catch the exception causing unescaping to fail silently.
For example, Revit Fill Pattern selection contains which contains invalid XML string when parsing. Internally, we escape this string to be
After unescaping, the string will went back to
Behavior after bug fixing
TODO:
Declarations
Check these if you believe they are true
*.resx
filesReviewers
@mjkkirschner @aparajit-pratap
FYIs
@BogdanZavu @dobriai