Skip to content

Complete formatter serialization cleanup (#3596) - #3601

Merged
xuzhg merged 1 commit into
dev-9.xfrom
xuzhg/issue-3596-remove-formatter-remnants
Aug 26, 2026
Merged

xuzhg merged 1 commit into
dev-9.xfrom
xuzhg/issue-3596-remove-formatter-remnants

Conversation

@xuzhg

@xuzhg xuzhg commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Remove the obsolete BinaryFormatter round-trip test and its legacy and .NET Core project references. The formatter constructors, GetObjectData overrides, Serializable attributes, warning suppressions, and public API entries were already removed from dev-9.x by #3334.

Remove the remaining NonSerialized annotations from response fields now that their containing exception types no longer support formatter serialization.

The reason to remove  [NonSerialized]  is cleanup and accuracy, not because the attribute itself is unsafe:

•  [NonSerialized]  tells formatter-based serializers to exclude a field from serialization.
• These exception classes are no longer  [Serializable]  and no longer expose serialization constructors or  GetObjectData .
• Therefore, the response fields cannot participate in formatter serialization, making  [NonSerialized]  functionally inert.
• Leaving it suggests that formatter serialization is still supported and that the field requires special serialization treatment.
• Removing it completes the cleanup described in #3596 without changing runtime behavior or public APIs.

References:

• Issue: #3596
•  [NonSerialized]  documentation: https://learn.microsoft.com/dotnet/api/system.nonserializedattribute
• Microsoft BinaryFormatter guidance: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide

Issues

This pull request fixes #xxx.

Description

Briefly describe the changes of this pull request.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

Repository notes

Team members can start a CI build by adding a comment with the text /AzurePipelines run to a PR. A bot may respond indicating that there is no pipeline associated with the pull request. This can be ignored if the build is triggered.

Team members should not trigger a build this way for pull requests coming from forked repositories. They should instead trigger the build manually by setting the "branch" to refs/pull/{prId}/merge where {prId} is the ID of the PR.

Remove the obsolete BinaryFormatter round-trip test and its legacy and .NET Core project references. The formatter constructors, GetObjectData overrides, Serializable attributes, warning suppressions, and public API entries were already removed from dev-9.x by #3334.

Remove the remaining NonSerialized annotations from response fields now that their containing exception types no longer support formatter serialization.
@xuzhg
xuzhg requested review from WanjohiSammy and a lite review from Copilot August 25, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown

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 completes the cleanup of legacy formatter-based (e.g., BinaryFormatter) serialization remnants in the OData Client test suite and exception types, aligning with the removal of serialization constructors/GetObjectData/[Serializable] work previously done in #3334 and the goals in issue #3596.

Changes:

  • Removes the obsolete BinaryFormatter round-trip unit test for DataServiceClientException.
  • Cleans up test project .csproj references that previously included/excluded that test file.
  • Removes now-inert [NonSerialized] annotations from response fields in client exception types that no longer support formatter serialization.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/FunctionalTests/Tests/DataServices/UnitTests/Client.TDD.Tests/Tests/DataServiceClientExceptionSerializationTests.cs Deletes the obsolete BinaryFormatter-based serialization test.
test/FunctionalTests/Tests/DataServices/UnitTests/Client.TDD.Tests/Microsoft.OData.Client.TDDUnitTests.NetCore.csproj Removes now-unneeded compile-removal entry for the deleted test file.
test/FunctionalTests/Tests/DataServices/UnitTests/Client.TDD.Tests/Microsoft.OData.Client.TDDUnitTests.csproj Removes compile include for the deleted test file to avoid build break.
src/Microsoft.OData.Client/DataServiceRequestException.cs Removes inert [NonSerialized] from the response field.
src/Microsoft.OData.Client/DataServiceQueryException.cs Removes inert [NonSerialized] from the response field.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@xuzhg

xuzhg commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/AzurePipelines run

@xuzhg
xuzhg merged commit b149201 into dev-9.x Aug 26, 2026
3 checks passed
@xuzhg
xuzhg deleted the xuzhg/issue-3596-remove-formatter-remnants branch August 26, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants