Skip to content

Add DataContractSerializer tests for System.Globalization types #118558

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 9, 2025

This PR adds missing test coverage for DataContractSerializer serialization of System.Globalization types as requested in the issue.

Changes Made

Added two new test methods to DataContractSerializer.cs:

  • DCS_CompareInfoAsRoot() - Tests serialization/deserialization of System.Globalization.CompareInfo using CultureInfo.InvariantCulture.CompareInfo
  • DCS_SortVersionAsRoot() - Tests serialization/deserialization of System.Globalization.SortVersion using the version from InvariantCulture's CompareInfo

Both tests follow the existing pattern using DataContractSerializerHelper.SerializeAndDeserialize<T>() and verify that the objects can be successfully serialized to XML and deserialized back to equivalent objects.

Testing

  • All existing tests continue to pass (343 → 345 total tests)
  • The new tests specifically verify round-trip serialization works correctly
  • XML format matches the actual serialization output from the DataContractSerializer

The implementation is minimal and surgical, adding only the required test coverage without modifying any existing functionality.

Fixes #24358.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

… and System.Globalization.SortVersion

Co-authored-by: StephenMolloy <[email protected]>
@Copilot Copilot AI changed the title [WIP] Add tests for DataContractSerializer serializing System.Globalization types Add DataContractSerializer tests for System.Globalization types Aug 9, 2025
Copilot finished work on behalf of StephenMolloy August 9, 2025 17:13
@Copilot Copilot AI requested a review from StephenMolloy August 9, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests for DataContractSerializer serializing System.Globalization types
2 participants