Skip to content

Add serializer conformance tests and baselines#10034

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:test/serializer-backcompat-tests
Apr 23, 2026
Merged

Add serializer conformance tests and baselines#10034
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:test/serializer-backcompat-tests

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Apr 23, 2026

Copy link
Copy Markdown
Member

This PR add snapshot-based testing for the serializer to help ensure we don't break things as we make changes to the serializer or source generator infrastructure.

Microsoft Reviewers: Open in CodeFlow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds snapshot-based conformance coverage for Orleans’ generated serializer, providing both byte-level baselines and human-readable formatted snapshots to detect wire-format drift as serializer/source-generator behavior evolves.

Changes:

  • Introduce GeneratedSerializerBitwiseCompatibilityTests which asserts bitwise-stable payloads against checked-in hex baselines and (where supported) Verify-based formatted snapshots.
  • Add Verify.Xunit dependency for non-netcoreapp3.1 TFMs to support snapshot verification.
  • Check in baseline (*.verified.hex.txt) and formatted (*.verified.txt) snapshot artifacts for the new test suite.
Show a summary per file
File Description
test/Orleans.Serialization.UnitTests/GeneratedSerializerBitwiseCompatibilityTests.cs New bitwise compatibility + formatted snapshot tests for generated serializer payloads.
test/Orleans.Serialization.UnitTests/Orleans.Serialization.UnitTests.csproj Adds Verify.Xunit for non-netcoreapp3.1 targets.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.WrapsMyForeignLibraryType_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for WrapsMyForeignLibraryType exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.WrapsMyForeignLibraryType_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for WrapsMyForeignLibraryType exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.SubClassWithRequiredMembersInBase_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for subclass required-members-in-base scenario.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.SerializableClassWithCompiledBase_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for compiled-base-class scenario.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ReadonlyGenericPersonExternalStruct_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for readonly generic external struct scenario.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person5_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for Person5 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person5_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for Person5 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person4_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for Person4 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person3_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for Person3 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person3_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for Person3 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person2External_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for external Person2 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person2External_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for external Person2 exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.Person2ExternalStruct_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for external Person2 struct exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.OuterInnerNonGen_Untyped_MatchesBaseline.verified.hex.txt Hex baseline for untyped outer/inner non-generic case.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.OuterInnerGen_Untyped_MatchesBaseline.verified.hex.txt Hex baseline for untyped outer/inner generic case.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.NestedGenericPoco_Untyped_MatchesBaseline.verified.hex.txt Hex baseline for nested generic POCO untyped serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.NestedGenericPoco_Untyped_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for nested generic POCO untyped serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.MySecondForeignLibraryType_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for second foreign-library type exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.MySecondForeignLibraryType_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for second foreign-library type exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.MyFirstForeignLibraryType_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for first foreign-library type exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.MyFirstForeignLibraryType_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for first foreign-library type exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ImmutableStruct_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for immutable struct exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ImmutableClass_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for immutable class exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GenericPocoString_Untyped_MatchesBaseline.verified.hex.txt Hex baseline for generic POCO untyped serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GenericPocoString_Untyped_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for generic POCO untyped serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GenericPersonExternal_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for generic external person exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GenericPersonExternal_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for generic external person exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GenericPersonExternalStruct_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for generic external struct exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GenericPersonExternalStruct_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for generic external struct exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedRecordSerializer_UntypedRoot_MatchesBaseline.verified.hex.txt Hex baseline for record serializer with untyped root.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedRecordSerializer_UntypedRoot_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for record serializer with untyped root.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedPolymorphicSerializer_BaseType_MatchesBaseline.verified.hex.txt Hex baseline for polymorphic serialization via base type.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedPolymorphicSerializer_BaseType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for polymorphic serialization via base type.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedClassSerializer_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for baseline class exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedClassSerializer_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for baseline class exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedAutoFieldIdSerializer_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for auto-field-id serializer exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.GeneratedAutoFieldIdSerializer_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for auto-field-id serializer exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.DuplicateReferences_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for duplicate-reference tracking behavior.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.DuplicateReferences_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for duplicate-reference tracking behavior.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.DuplicateReferencesSuppressTracking_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for duplicate refs with suppress-tracking behavior.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.DuplicateReferencesSuppressTracking_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for duplicate refs with suppress-tracking behavior.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.DerivedFromDictionary_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for derived dictionary exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.DerivedFromDictionary_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for derived dictionary exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ClassWithTypeFields_Untyped_MatchesBaseline.verified.hex.txt Hex baseline for type-field-containing class untyped serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ClassWithTypeFields_Untyped_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for type-field-containing class untyped serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ClassWithRequiredMembers_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for required-members class exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ClassWithRequiredMembers_ExactType_Formatted_MatchesSnapshot.verified.txt Formatted snapshot for required-members class exact-type serialization.
test/Orleans.Serialization.UnitTests/snapshots/GeneratedSerializerBitwiseCompatibilityTests.ClassWithImplicitFieldIds_ExactType_MatchesBaseline.verified.hex.txt Hex baseline for implicit field-id generation behavior.

Copilot's findings

  • Files reviewed: 50/50 changed files
  • Comments generated: 0

@ReubenBond ReubenBond added this pull request to the merge queue Apr 23, 2026
Merged via the queue into dotnet:main with commit 2fc2123 Apr 23, 2026
66 checks passed
@ReubenBond ReubenBond deleted the test/serializer-backcompat-tests branch April 23, 2026 22:53
@github-actions github-actions Bot locked and limited conversation to collaborators May 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants