Skip to content

Add DataContractSerializer tests for System.Globalization types#118558

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-24358
Closed

Add DataContractSerializer tests for System.Globalization types#118558
Copilot wants to merge 2 commits intomainfrom
copilot/fix-24358

Conversation

Copy link
Contributor

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]>
@dotnet-policy-service
Copy link
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@jkotas jkotas deleted the copilot/fix-24358 branch December 22, 2025 05:41
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for DataContractSerializer serializing System.Globalization types

3 participants