-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improve code coverage for System.Text.Json with targeted unit tests #120731
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
Conversation
Co-authored-by: stephentoub <[email protected]>
|
@copilot, please mark the DeepEquals_TooDeepJsonDocument_ThrowsInsufficientExecutionStackException test as [Outerloop] and try again, following my original instructions. |
Co-authored-by: stephentoub <[email protected]>
Done. Marked the test as [OuterLoop] and reverted the other test changes that had incorrect assertions. All tests now pass. Changes committed in edead34. |
|
…Deserialize from Span Co-authored-by: stephentoub <[email protected]>
Co-authored-by: stephentoub <[email protected]>
Working on it:
Next steps: Will re-run coverage analysis and continue adding tests for remaining uncovered areas. Changes committed in eace0c3. |
Co-authored-by: stephentoub <[email protected]>
|
@copilot, please keep iterating: run coverage, add more tests to fill gaps, re-run coverage, add more tests to fill gaps, etc. Please try to get line and branch coverage to greater than 95%. |
…th JsonTypeInfo Co-authored-by: stephentoub <[email protected]>
…alize methods Co-authored-by: stephentoub <[email protected]>
Continuing iterations: Current Progress:
Tests Added:
Next Steps to reach >95%:
Continuing to add more tests... |
Co-authored-by: stephentoub <[email protected]>
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/DomTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/JsonValueTests.cs
Outdated
Show resolved
Hide resolved
|
@copilot, please address the feedback from @eiriktsarpalis |
…o avoid cache recreation Co-authored-by: stephentoub <[email protected]>
Fixed in commit 0c7a2e5db. Replaced all instances of creating new JsonSerializerOptions with TypeInfoResolver with JsonSerializerOptions.Default to avoid wasteful cache recreation. |
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/JsonValueTests.cs
Outdated
Show resolved
Hide resolved
…ons.Default Co-authored-by: stephentoub <[email protected]>
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/DomTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: stephentoub <[email protected]>
Summary
Through systematic iterations, this PR improved System.Text.Json coverage from 93.73% to 94.27% (+0.54%) by adding 136 targeted unit tests covering previously untested API surfaces including JsonSerializer methods with JsonTypeInfo/JsonSerializerContext, multi-segment Utf8JsonReader scenarios, JsonWriter formatting options, JsonNode operations, JsonNamingPolicy variants, and collection serialization.
Remaining gaps to reach 95% (~215 lines) consist primarily of complex Utf8JsonReader edge cases requiring specialized buffer setups, ThrowHelper exception paths, and F# converter infrastructure.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.