Skip to content

fix(serialization): resolve compound-aliased array type names - #11392

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-compound-alias-array-fix
Oct 2, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-compound-alias-array-fix

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Problem

Compound-aliased array type-name resolution is broken on main 9bb744ad5fe9bd0a512052f1b11c1d6b6f7a44f1. Resolving an element's compound alias can produce an assembly-qualified type specification. HandleArray then places the array suffix after that element's assembly qualifier, instead of qualifying the complete array. This prevents parsing array type headers, including array arguments in closed generic types.

The ordinary serializer on that main revision successfully writes polymorphic payloads containing these headers, then fails to read them. This is a pre-existing runtime bug exposed while working on #11382, and is fixed here in a separate main-based PR.

Solution

Unwrap the resolved element's assembly qualification at the array boundary and return the array specification alongside its assembly name, following the existing generic-type boundary handling. This preserves compound-alias component validation and type-allowlist semantics.

Wire compatibility

Check in 18 hex fixtures emitted by the production Serializer.SerializeToArray<T> implementation before the runtime fix, with pinned main SHA, rewriter source blob, serializer assembly version, and stable test type identities. The original writer produced identical bytes on actual .NET 8 and .NET 10 runtimes.

Nine fixtures already deserialized successfully on main; nine polymorphic array/generic payloads were writable but historically unreadable because of this bug. The fixed reader successfully deserializes all 18 frozen fixtures, and the current writer emits byte-for-byte identical payloads. Assertions cover null and empty arrays, vectors, jagged arrays, ranks two and three, arrays inside closed generics, alias components from a non-core assembly, shared element/array references, and an array/element cycle.

This gives a scoped compatibility guarantee for these affected wire forms: previously supported payloads remain readable with identical writer bytes, and previously unreadable compound-alias array headers become readable using their original bytes. Dedicated regressions retain explicit denials and fail-closed type policies. The full existing serializer unit/compatibility suite passes on both target runtimes (4,333 tests on .NET 8 and 4,337 on .NET 10); the normal Release package passes baseline compatibility validation.

The empty multidimensional [2,0] codec issue discovered during baseline capture is tracked separately in #11391. The empty rank-two fixture here uses the supported [0,2] shape, also captured using the unmodified main writer.

Microsoft Reviewers: Open in CodeFlow

Copilot AI balanced review requested due to automatic review settings October 2, 2026 19:24

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.

Copilot review overview

🟢 Approval recommended

The focused fix is supported by comprehensive resolution, security-policy, and frozen wire-compatibility coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes compound-aliased array type resolution by applying assembly qualification to the complete array type while preserving wire compatibility.

Changes:

  • Corrects assembly qualification at array boundaries.
  • Adds type-filter and fail-closed regression coverage.
  • Adds 18 frozen compatibility fixtures covering typed and polymorphic arrays.
File Description
src/​Orleans.Serialization/​TypeSystem/​RuntimeTypeNameRewriter.cs Corrects array assembly qualification.
test/​Orleans.Serialization.UnitTests/​TypeConverterTests.cs Tests filtering and fail-closed behavior.
test/​Orleans.Serialization.UnitTests/​CompoundAliasArrayTests.cs Adds resolution and wire-compatibility tests.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedNull.verified.hex.txt Adds typed-null fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedEmpty.verified.hex.txt Adds typed-empty fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedVector.verified.hex.txt Adds typed-vector fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedJagged.verified.hex.txt Adds typed-jagged fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedRankTwo.verified.hex.txt Adds typed rank-two fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedRankThree.verified.hex.txt Adds typed rank-three fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.TypedEnvelope.verified.hex.txt Adds typed-envelope fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedElement.verified.hex.txt Adds polymorphic-element fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedEmpty.verified.hex.txt Adds polymorphic-empty fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedVector.verified.hex.txt Adds polymorphic-vector fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedJagged.verified.hex.txt Adds polymorphic-jagged fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedRankTwo.verified.hex.txt Adds polymorphic rank-two fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedRankThree.verified.hex.txt Adds polymorphic rank-three fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedEmptyRankTwo.verified.hex.txt Adds empty multidimensional fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedEnvelope.verified.hex.txt Adds polymorphic-envelope fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedList.verified.hex.txt Adds generic-container fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedGenericElementArray.verified.hex.txt Adds generic-element-array fixture.
test/​Orleans.Serialization.UnitTests/​snapshots/​CompoundAliasArrayTests.UntypedCycle.verified.hex.txt Adds cyclic-reference fixture.

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

@ReubenBond
ReubenBond merged commit cdb7961 into dotnet:main Oct 2, 2026
83 checks passed
@ReubenBond
ReubenBond deleted the rb-compound-alias-array-fix branch October 2, 2026 19:48
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request
Lines 82.94% (115,599 / 139,371)
Branches 72.29% (33,607 / 46,487)

Report-only conclusion: current-main baseline stale.

The newest successful coverage run tested 6bf11ad, not current main cdb7961.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

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