Skip to content

Conversation

@BradBarnich
Copy link
Contributor

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

@Copilot Copilot AI review requested due to automatic review settings April 23, 2025 19:25
@ghost ghost added the area-Serialization label Apr 23, 2025
Copy link
Contributor

Copilot AI left a 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.

@StephenMolloy StephenMolloy self-assigned this Sep 4, 2025
@StephenMolloy StephenMolloy self-requested a review September 4, 2025 22:14
Copy link
Member

@StephenMolloy StephenMolloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@BradBarnich BradBarnich force-pushed the xml-keep-datetime-kind branch from 3f99553 to 818d29c Compare September 10, 2025 13:19
@StephenMolloy StephenMolloy added this to the 10.0.0 milestone Sep 11, 2025
@StephenMolloy StephenMolloy merged commit 6246c4d into dotnet:main Sep 19, 2025
86 of 88 checks passed
@StephenMolloy
Copy link
Member

/backport to release/10.0

@github-actions
Copy link
Contributor

Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17871050411

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Serialization community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants