Skip to content

fix(serialization): defer interface collection codec dependencies - #10301

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:reubenbond-fix-codec-regression-10300
Jul 30, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:reubenbond-fix-codec-regression-10300

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Fixes #10300

Orleans 10.2 interface collection codecs eagerly unwrapped their fallback element codecs during construction. A generated type containing an interface collection field could therefore fail while its codec was being constructed—even when the field was null—because the interface codec resolved an unavailable element codec before any runtime collection value existed.

Keep the injected fallback codec holders lazy so concrete runtime codecs are resolved first and null fields require no element codec. Preserve the existing interface codec type as the fallback wire-format identity, and cover both generated null-field and custom concrete-runtime-codec scenarios.

Copilot AI review requested due to automatic review settings July 23, 2026 14:53
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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

This PR addresses a regression introduced in Orleans 10.2 where interface collection codecs eagerly resolve element codecs, causing IList<SequentialItem<T>> codec resolution to fail because SequentialItem<T> was not marked as serializable.

Changes:

  • Mark SequentialItem<T> as a generated-serializable type with stable member IDs.
  • Add a regression test which validates codec resolution for SequentialItem<T> and IList<SequentialItem<T>>, plus a simple round-trip serialization check.
Show a summary per file
File Description
test/Orleans.Core.Tests/Serialization/BuiltInSerializerTests.cs Adds regression coverage for SequentialItem<T> and interface-list codec resolution plus a round-trip check.
src/Orleans.Streaming/Core/IAsyncBatchObserver.cs Annotates SequentialItem<T> with [GenerateSerializer] and stable [Id] attributes so codecs can be generated/resolved.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread src/Orleans.Streaming/Core/IAsyncBatchObserver.cs
Copilot AI review requested due to automatic review settings July 23, 2026 15:28
@ReubenBond ReubenBond changed the title fix(streaming): add SequentialItem serializer fix(serialization): defer interface collection codec dependencies Jul 23, 2026

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's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Copilot AI review requested due to automatic review settings July 23, 2026 15:52

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's findings

Comments suppressed due to low confidence (1)

test/Orleans.Serialization.UnitTests/InterfaceCollectionCodecTests.cs:549

  • class declarations in C# require a body; public sealed class UnsupportedElement; will not compile. Use an empty body instead.
    public sealed class UnsupportedElement;
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new

@ReubenBond
ReubenBond force-pushed the reubenbond-fix-codec-regression-10300 branch from d247633 to 56fe38d Compare July 30, 2026 20:23
Copilot AI review requested due to automatic review settings July 30, 2026 21:04
@ReubenBond
ReubenBond force-pushed the reubenbond-fix-codec-regression-10300 branch from 56fe38d to d0ce381 Compare July 30, 2026 21:04

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's findings

Comments suppressed due to low confidence (2)

src/Orleans.Streaming/Core/IAsyncBatchObserver.cs:28

  • SequentialItem<T>.Item no longer has an [Id] attribute. This changes the serialized schema and will break compatibility with previously serialized payloads and existing generated-code expectations for this type.
        /// <value>The item.</value>
        public T Item { get; }

src/Orleans.Streaming/Core/IAsyncBatchObserver.cs:35

  • SequentialItem<T>.Token no longer has an [Id] attribute. This changes the serialized schema and will break compatibility with previously serialized payloads and existing generated-code expectations for this type.
        public StreamSequenceToken Token { get; }
    }
  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment on lines 10 to 12
/// <typeparam name="T">The item type.</typeparam>
[GenerateSerializer]
public class SequentialItem<T>
{
Keep fallback codec services lazy so interface collection codecs can select a concrete runtime codec before resolving fallback element codecs. Preserve the existing interface codec wire type and cover generated null fields and custom concrete collection codecs.

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

Copilot-Session: 8c9979b4-a5d3-45d0-8c6b-118d500f9ff7
Copilot AI review requested due to automatic review settings July 30, 2026 21:10
@ReubenBond
ReubenBond force-pushed the reubenbond-fix-codec-regression-10300 branch from d0ce381 to 22170f3 Compare July 30, 2026 21:10

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's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new

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.

Codec not found exception since upgrade to 10.2.x

2 participants