-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Remove workaround for fixed invalid json array deserializing bug #8346
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
Remove workaround for fixed invalid json array deserializing bug #8346
Conversation
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.
Please add a test to ensure the expected exception is thrown on invalid array.
@PaulHigin done! |
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.
LGTM
@louistio Thanks for your contribution! |
It looks to me this PR causes the following feature-level test to fail: Lines 1446 to 1459 in 3794a5e
This PR didn't have [feature] tag in commit message, so the feature-level tests didn't run. Here is the failure:
Affected CIs: Linux CI: https://powershell.visualstudio.com/PowerShell/_build/results?buildId=7147 |
We already had feature tests for this case and they are failing after the removal of the workaround. I'm reverting the change. |
…rializing bug (PowerShell#8346)" This reverts commit 60a4e2f.
I'm sorry about this inconvenience, I was not aware of the existence of this particular test and should have been. I debugged this issue locally as soon as I could, the new error is caused by yet another Sorry again. |
@louistio No problem, things happen. To automatically run the tests, prefix the last commit with |
Oh, seems we need re-pack our tests or at least update the code comment. @louistio Could you please make PR and update the comment with new information? |
…8377) This is a follow up to reverted PR #8346. I removed a workaround that was used to avoid [a Newtonsoft.Json bug](JamesNK/Newtonsoft.Json#1321) that caused some incomplete json array input to successfully be deserialized. This bug being fixed, I thought the workaround was unnecessary, but after the merge some feature tests started to fail (which I did not run prior to merging). It was discovered that the workaround is still needed because while the first Newtonsoft.Json bug was fixed, some cases of incomplete json array input still behave unexpectedly, namely json input `[`. This PR is just to update the comment explaining the workaround so it links to the newly created issue [here](JamesNK/Newtonsoft.Json#1930).
PR Summary
This PR removes a workaround that was added because of a bug in the underlying json deserializing library Newtonsoft.Json.
It is no longer required as the bug has been fixed in Newtonsoft.Json 10.0.3, see fix here.
This workaround was added in #3823 and involves using a regex to detect a json array and calling
JArray.Parse
before deserialization to throw an exception on an invalid array. As a result, removing it will increaseConvertFrom-Json
&Invoke-RestMethod
performance.Current behavior
After workaround removal
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
to the beginning of the title and remove the prefix when the PR is ready.