Remove workaround for fixed invalid json array deserializing bug#8346
Conversation
PaulHigin
left a comment
There was a problem hiding this comment.
Please add a test to ensure the expected exception is thrown on invalid array.
|
@PaulHigin done! |
|
@louistio Thanks for your contribution! |
|
It looks to me this PR causes the following feature-level test to fail: 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.Parsebefore deserialization to throw an exception on an invalid array. As a result, removing it will increaseConvertFrom-Json&Invoke-RestMethodperformance.Current behavior
After workaround removal
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.