Repository navigation
Conversation
…lues XmlDeserializer.Culture (invariant by default) was ignored for primitive properties and list items, which went through Convert.ChangeType with the current culture. Under tr-TR, de-DE, etc. "1234.5" became 12345 for a double, or threw a FormatException (fr-FR). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Code Review by Qodo
1. Locale-formatted numbers that used to parse now throw
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
XmlDeserializer.Culturedefaults toCultureInfo.InvariantCulture, but primitive properties and primitive list items ignored it: they were converted withConvert.ChangeType(source, newType), which uses the current culture. So with the default settings, under tr-TR or de-DE<Double>1234.5</Double>silently deserializes to12345, and under fr-FR it throws aFormatException.XmlAttributeDeserializergoes through the same code.The internal
ChangeTypeextension now takes anIFormatProvider, and both callers inXmlDeserializerpassCulture.Tests in
XmlDeserializerTests:Should_deserialize_floating_point_numbers_with_invariant_culture_by_default(theory over tr-TR, de-DE, fr-FR asCurrentCulture): adouble, afloatand aList<double>.Should_deserialize_floating_point_numbers_with_configured_culture:Culture = de-DEwith comma input whileCurrentCultureis invariant.All 4 cases fail without the change (e.g.
Expected: 1234,5 Actual: 12345, and theFormatExceptionfor fr-FR) and pass with it.RestSharp.Tests.Serializers.Xmlpasses on net10.0 and net8.0 (115 tests),RestSharp.Testson net10.0 (275). I did not run the net48/net9.0 targets or the integrated tests.Purpose
This pull request is a:
Checklist
This change was written with Claude Code.
🤖 Generated with Claude Code