feat(csharp): support generated class inheritance - #3893
Merged
chaokunyang merged 6 commits intoJul 28, 2026
Conversation
chaokunyang
marked this pull request as draft
July 28, 2026 01:49
chaokunyang
marked this pull request as ready for review
July 28, 2026 02:03
theweipeng
approved these changes
Jul 28, 2026
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.
Why?
Generated C# serializers previously modeled only members declared by the concrete class. Base-class
wire members could be omitted from field ordering, schema metadata, reads, and writes, while private
parent storage could not be included correctly when the parent came from another compilation.
Third-party base classes also need an explicit, application-owned way to describe inaccessible
fields without inspecting private assembly metadata.
What does this PR do?
serializer flattens the immediate parent provider's wire members with its own members and composes
cumulative shallow-storage bytes without calling a parent serializer.
schema behavior and graph-memory reservation each have one clear owner.
TargetDeclaringTypeandTargetMemberName, plusBaseOnlydeclarations for unmodifiable third-party hierarchy prefixes and storage-only fields.accessibility, generic construction, and override/member identities before generating child code.
ForyModelGeneratorinto focused partial files for analysis, hierarchy composition,external mappings, models, and emission while retaining one generation path.
and C# xlang coverage, and updates the C# guides and xlang implementation specification.
Related issues
N/A
AI Contribution Checklist
yes/noyes, I included a completed AI Contribution Checklist in this PR description and the requiredAI Usage Disclosure.yes, my PR description includes the requiredai_reviewsummary and screenshot evidence or equivalent persisted links of the final clean AI review results from both fresh reviewers described inAI_POLICY.md, the Fory-guided reviewer and the independent general reviewer, on the current PR diff or current HEAD after the latest code changes.Does this PR introduce any user-facing change?
Yes. Annotated C# class hierarchies now serialize inherited fields. External serializer declarations
gain
BaseOnly,TargetDeclaringType, andTargetMemberNamefor explicit third-party classhierarchy and private-field mappings. The shared binary protocol encoding is unchanged.
Benchmark
The existing C# external-equivalence benchmark model now declares exact backing storage through
storage-only external mappings. This PR does not add a benchmark harness or a separate inheritance
benchmark path.