Repository navigation
Serialization.V2: object elements inside collections are envelope-payload boundaries (stacked on #8521) - #8523
Closed
Aaronontheweb wants to merge 1 commit into
Conversation
…load boundaries Extends Decision 20 (an object-typed property is always the envelope-payload boundary) to collection elements: a List<object>, object[], or any other natively-supported collection whose element type is object (or object?) now treats each element as its own envelope-payload boundary, using the same WriteEnvelopePayload/ReadEnvelopePayload/SizeOfEnvelopePayload runtime helpers and nil framing a field already uses. Dictionary values typed object are supported the same way; a dictionary KEY typed object is rejected with AKKASG003 instead, since a round-tripped envelope payload has no stable identity for hash/equality lookups and a nullable object? key would crash Dictionary<TKey,TValue> at runtime.
Member
Author
|
Closing: this change is being reopened as part of a native GitHub stack with all branches in akkadotnet/akka.net (stacks cannot span a fork). Same commits, same content; the new PR will link back here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #8384. Extends Decision 20 (OpenSpec design record) to collection elements: a supported collection whose element type is
objectorobject?treats each element as an envelope-payload boundary, the same frame a property typedobjectgets since #8518. Closes the limitation that #8520 documented in the guide.Stacked on #8521 (S1); the diff is one commit. It is independent of #8522 (S2) and rebases onto whichever lands first.
What changes
objectmaps to the envelope-payload kind, nullable-aware, for every collection shape the generator supports: arrays, lists, read-only lists and collections, sets, immutable collections, and dictionary values. All of them funnel through one element-mapping routine, so there is no per-shape special case.UnknownSizepropagation for size. Every other element kind is byte-for-byte untouched.objectstay rejected with AKKASG003, and the reason is in a code comment: a null key crashes a dictionary at run time, and an envelope payload is a fresh instance on read, so a round-tripped key has no stable identity for lookup.Tests and snapshots
ObjectElementSpec, eight facts: round trips forList<object>,object[],Dictionary<string, object>, andImmutableList<object>holding a message from the same serializer, a string, and an int; a nullable element holding null;SizeHintreportingUnknownSizewhen an element's serializer cannot size it; the nesting-depth guard reached through a collection element; and the AKKASG003 fact forDictionary<object, string>.List<object>field. The diff against the verified file is purely additive; every pre-existing line is unchanged. The model snapshot from S1 gains the same message.envelope-list-element-string-and-message, pins the bytes for a list holding a string and a message.dotnet test src/core/Akka.Serialization.V2.Tests -c Release: 287 passed. Generator builds with warnings as errors.Akka.Remotebuilds.OpenSpec
Scenario "Object elements inside a collection are boundaries" added under the envelope-boundary requirement in the source-generator spec; task 5.17 added.
Follow-up
The guide's supported-types table and limitations section list this as unsupported since #8520. A one-line docs change lands after this merges.