Skip to content

Add MemoryPack Serializer#9838

Merged
ReubenBond merged 3 commits into
dotnet:mainfrom
Drecik:main
Feb 15, 2026
Merged

Add MemoryPack Serializer#9838
ReubenBond merged 3 commits into
dotnet:mainfrom
Drecik:main

Conversation

@Drecik

@Drecik Drecik commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Add memorypack for orleans serializer

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings December 10, 2025 10:22
@Drecik

Drecik commented Dec 10, 2025

Copy link
Copy Markdown
Contributor Author

@Drecik please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/Orleans.Serialization.MemoryPack/MemoryPackCodec.cs:129

  • MemoryPackCodec deserialization also ignores configured MemoryPackSerializerOptions because it calls MemoryPackSerializer.Deserialize(type, sequence) without options. Use the overload which accepts _options.SerializerOptions to ensure symmetry with serialization and DeepCopy, and to honor options set via AddMemoryPackSerializer.
                    var bufferWriter = new BufferWriterBox<PooledBuffer>(new());
                    try
                    {
                        reader.ReadBytes(ref bufferWriter, (int)length);
                        result = MemoryPackSerializer.Deserialize(type, bufferWriter.Value.AsReadOnlySequence());
                    }

Comment on lines +68 to +76
var bufferWriter = new BufferWriterBox<PooledBuffer>(new());
try
{
MemoryPackSerializer.Serialize(value.GetType(), bufferWriter, value);

ReferenceCodec.MarkValueField(writer.Session);
writer.WriteFieldHeaderExpected(1, WireType.LengthPrefixed);
writer.WriteVarUInt32((uint)bufferWriter.Value.Length);
bufferWriter.Value.CopyTo(ref writer);

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

MemoryPack serializer options configured via AddMemoryPackSerializer()/MemoryPackCodecOptions are currently ignored during field serialization because the Serialize call uses the default options overload. Pass _options.SerializerOptions to MemoryPackSerializer.Serialize so that user configuration is honored (consistent with DeepCopy and MessagePackCodec).

This issue also appears on line 124 of the same file.

Copilot uses AI. Check for mistakes.
Comment thread test/Orleans.Serialization.UnitTests/Models.cs
Comment thread test/Orleans.Serialization.UnitTests/MemoryPackSerializerTests.cs
Comment thread src/Orleans.Serialization.MemoryPack/MemoryPackCodecOptions.cs Outdated
@ReubenBond ReubenBond force-pushed the main branch 3 times, most recently from 5563b02 to 59a4f46 Compare February 15, 2026 17:01
@ReubenBond ReubenBond enabled auto-merge February 15, 2026 17:20
大神 and others added 3 commits February 15, 2026 13:02
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ReubenBond ReubenBond added this pull request to the merge queue Feb 15, 2026
Merged via the queue into dotnet:main with commit e72de97 Feb 15, 2026
59 checks passed
rkargMsft pushed a commit to rkargMsft/orleans that referenced this pull request Feb 27, 2026
* support memorypack serialization

* add memory pack serializer tests

* Address MemoryPack serializer review feedback

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

---------

Co-authored-by: 大神 <xuchen@babuyo.com>
Co-authored-by: Reuben Bond <reuben.bond@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants