Uh oh!
There was an error while loading. Please reload this page.
Avoid serializing inline Azure Storage queue messages twice - #1380
Avoid serializing inline Azure Storage queue messages twice#1380Bernd Verst (berndverst) wants to merge 2 commits into
Conversation
Reuse the MessageData JSON already produced for size selection when the payload remains inline. Add exact wire-equivalence and threshold-path regression coverage for both serialization modes and a custom binder. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9509e194-db0b-4024-b7b0-26481278e0db
Verify exact inline payload equivalence, single-pass custom binder behavior, and the inline/blob boundary for both data-contract serialization modes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9509e194-db0b-4024-b7b0-26481278e0db
There was a problem hiding this comment.
Pull request overview
This PR removes a redundant JSON serialization on the common inline-queue-message path in MessageManager.SerializeMessageDataAsync, reusing the already-produced JSON payload that was generated for the UTF-8 size check. It adds regression tests to assert byte-for-byte equivalence with the prior “serialize twice” behavior (including custom type binder behavior and both UseDataContractSerialization modes), and to validate behavior at the exact 45 KiB inline threshold and just above it (blob offload + wrapper).
Changes:
- Reuse the initial
rawContentJSON string for inline queue payloads instead of serializingMessageDataa second time. - Add tests validating inline payload equivalence (including custom binder behavior) in both
UseDataContractSerializationmodes. - Add boundary tests covering the exact 45 KiB inline cutoff and the above-threshold blob-wrapper path (including verifying stored blob content).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/DurableTask.AzureStorage/MessageManager.cs | Avoids duplicate serialization by returning the already-generated rawContent for inline messages. |
| test/DurableTask.AzureStorage.Tests/MessageManagerTests.cs | Adds regression coverage for inline payload equivalence and for inline/blob behavior at and above the 45 KiB threshold. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
MessageDataJSON already produced for the UTF-8 size check when a queue message stays inlineUseDataContractSerializationmodesBackward compatibility
The initial serialization already determines both the queue payload size and the inline/blob decision.
TotalMessageSizeBytesis internal and is not a data member, so returning that existing JSON on the inline path is byte-for-byte equivalent to the previous second serialization. The size threshold, serializer configuration, public APIs, blob upload content, and blob-reference wrapper serialization are unchanged.Testing
dotnet test Test\DurableTask.AzureStorage.Tests\DurableTask.AzureStorage.Tests.csproj --framework net8.0 --filter "FullyQualifiedName~DurableTask.AzureStorage.Tests.MessageManagerTests"dotnet test Test\DurableTask.AzureStorage.Tests\DurableTask.AzureStorage.Tests.csproj --framework net48 --filter "FullyQualifiedName~DurableTask.AzureStorage.Tests.MessageManagerTests"Fixes#1378