-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix ReadContentAsDateTime method to keep DateTimeKind #114969
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses issue #114813 by updating the ReadContentAsDateTime method to preserve the DateTimeKind, aligning its behavior with the framework's implementation.
- Updated ReadContentAsDateTime to directly call InnerReader.ReadContentAsDateTime() instead of extracting the DateTime from a DateTimeOffset.
- Ensured consistency with the framework's implementation as referenced in the description.
....Private.DataContractSerialization/src/System/Runtime/Serialization/XmlSerializableReader.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
419a6c7 to
3f99553
Compare
3f99553 to
818d29c
Compare
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17871050411 |
potential fix for #114813
roundtripping through DateTimeOffset.DateTime loses the DateTimeKind, which in some code paths causes incorrect interpretation in DateTimeOffsetAdapter
this is also what the code looks like in framework: https://github.com/microsoft/referencesource/blob/master/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableReader.cs#L117