Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 19, 2025

Backport of #119865 to release/10.0

/cc @StephenMolloy @copilot

Customer Impact

  • Customer reported
  • Found internally

XmlSerializer silently omits public members marked with [Obsolete], even though the attribute’s documented purpose is only to signal planned removal and guide developers at compile time. Because teams often stage deprecation by first adding [Obsolete] (with or without a warning-as-error) before later removing a member, this hidden coupling between deprecation metadata and runtime serialization creates a correctness and data loss risk: persisted XML stops containing the member’s data even though the member still exists and application code still reads it. This behavior is also inconsistent with the explicit opt out model already provided by [XmlIgnore].

Regression

  • Yes
  • No

Testing

Tests are added in this PR.

Risk

This is a low risk approach that prevents silent data omission while providing an escape hatch for existing applications. The risk of exceptions being thrown (for data that was being silently lost previously) is mitigated by an AppContext switch opt-out along with the increased awareness of the fact that XmlSerialzier was silently losing data before. :/

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

@StephenMolloy StephenMolloy self-requested a review September 19, 2025 22:23
@StephenMolloy StephenMolloy self-assigned this Sep 19, 2025
@StephenMolloy StephenMolloy added Servicing-consider Issue for next servicing release review area-Serialization labels Sep 19, 2025
@StephenMolloy StephenMolloy added this to the 10.0.0 milestone Sep 19, 2025
@StephenMolloy StephenMolloy added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 22, 2025
@artl93 artl93 merged commit 78c049d into release/10.0 Sep 22, 2025
94 of 97 checks passed
@jkotas jkotas deleted the backport/pr-119865-to-release/10.0 branch September 22, 2025 23:27
@StephenMolloy StephenMolloy added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Sep 26, 2025
Copy link
Contributor

Added needs-breaking-change-doc-created label because this PR has the breaking-change label.

When you commit this breaking change:

  1. Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.
  2. Ask a committer to mail the .NET Breaking Change Notification DL.

Tagging @dotnet/compat for awareness of the breaking change.

@dotnet-policy-service dotnet-policy-service bot added the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Serialization breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants