Repository navigation
Serialization.V2: pin cross-assembly generator behavior, fix AKKASG023 mislabel, add fix-it hints - #8512
Merged
Aaronontheweb merged 3 commits intoSep 5, 2026
Conversation
…3 mislabel, add fix-it hints Part of akkadotnet#8384. - CrossAssemblyBaselineSpec: six two-assembly characterization tests for types declared in a referenced assembly - A non-generic [AkkaSerializable] type missing from the message table now reports AKKASG007, not AKKASG023 (which stays for real closed generics) - AKKASG003, AKKASG007, and AKKASG015 now say how to fix the problem; the cross-assembly variants name the type and its assembly - design.md line 199 corrected: a closed-generic registration over a definition from a referenced assembly already works
Aaronontheweb
force-pushed
the
feature/serialization-v2-cross-assembly-baseline
branch
from
September 5, 2026 14:12
9269194 to
5e41604
Compare
…tic changes Review follow-up on PR akkadotnet#8512. No behavior change: same diagnostics, same message text, same 269 passing tests, no golden or snapshot changes. AkkaSerializerGenerator.cs: - Replace the objectTypeName.Contains('<') string test with an explicit TypeMapping.IsGenericConstruction bool, set once from INamedTypeSymbol.IsGenericType where the Object mapping is created, and threaded through equality/hash/With* like the other mapping flags. - Merge CollectObjectTypeNames and CollectObjectMappings into one EnumerateObjectMappings traversal that yields mappings; callers that only need names project TypeFullName themselves. - Collapse the three report sites that each chose between a same-assembly and cross-assembly descriptor (or AKKASG023 vs AKKASG007) into two helpers, ReportMissingNestedSchema and ReportUnionMemberNotSerializable, each carrying a short plain-English comment for its decision table. No report site branches more than once now. - Trim several overlong XML doc comments picked up along the way. CrossAssemblyBaselineSpec.cs: - Rewrite the case comments in plain, short-sentence English. Case 1 gets an ASCII diagram of the symbol-vs-syntax mechanism that produces AKKASG007 instead of AKKASG023; the other five cases get short prose. Generator diff against akkadotnet/dev: 175 insertions / 32 deletions (net +143), down from 173 / 22 (net +151) before this pass.
Aaronontheweb
commented
Sep 5, 2026
| public sealed class CrossAssemblyBaselineSpec | ||
| { | ||
| [Fact(DisplayName = "Cross-assembly baseline: nested field type declared and [AkkaSerializable] in a referenced assembly fails AKKASG007 with a cross-assembly hint naming the type and its assembly, never the AKKASG023 closed-generic mislabel")] | ||
| public void Nested_field_type_from_referenced_assembly() |
Member
Author
There was a problem hiding this comment.
This test is going to turn green later as we introduce cross assembly scanning. Right now it's meant to basically be a failure test.
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. First of several small PRs.
The V2 source generator reads
[AkkaSerializable]schemas only from the syntax of the current compilation. This PR pins what that means for types declared in a referenced assembly, fixes one mislabeled diagnostic, and makes three diagnostics say how to fix the problem.Changes
CrossAssemblyBaselineSpec. It compiles two assemblies in memory, runs the generator on the second, and pins six cases:[AkkaSerializable]type from a referenced assembly: AKKASG007 with a cross-assembly hint. Before this PR it was a mislabeled AKKASG023 that called a plain record a "closed generic"[AkkaSerializable<T>]: works, typed helpers emitted. Without the registration: AKKASG023[AkkaEnvelopePayload]on a generic property, substituted through a referenced definition: honored[AkkaSerializable]type missing from the message table now reports AKKASG007, not AKKASG023. AKKASG023 stays for real closed generic constructions.openspec/changes/messagepack-sourcegen-validation/design.mdline 199 corrected. It claimed a closed-generic registration over a referenced-assembly definition does not work. It does.Testing
dotnet test src/core/Akka.Serialization.V2.Tests -c Release: 269 passed, 0 failed. No generated code changed. Golden-output tests are untouched.Next
Schema extraction from referenced-assembly metadata, Decision 16 in the OpenSpec design record, as a separate PR. That turns the "cannot read a schema from a referenced assembly yet" case into a working one.