You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Native RPC response handling selected pooled codecs and copiers by closing open generic implementations at runtime. Generate concrete, non-generic response holders and closed construction graphs for source-known method results and proxy dependencies.
The generator emits identical invocation and registration code for managed and NativeAOT publishing. Closed factories participate through the common provider resolution pipeline, with application registration precedence selecting services in either execution mode. Full emitted-source parity is covered directly, including result models, collections, primitive responses, completion responses, and explicit serializer contexts.
Generated invokables implement IResponseInvokable, isolate mutable results before incoming filters resume, and rent a successful holder with provider-owned dependencies. Incoming filters can transform the response envelope and nested references; the runtime copies their selected result for delivery. The invocation context owns every superseded filter response until completion, supports restoring earlier selections, and releases each unselected wrapper exactly once. Unfiltered calls transfer the invocation-time copy directly, and expired or one-way requests release the owned response. IRawResponseWriter writes the existing raw protocol directly before the sender queries a response codec. Closed IRawResponseReader registrations reconstruct holders from the wire result type. Primitive codecs, reference cycles, shared identity, pool reset, completion responses, exceptions, and custom implementation dispatch retain their established semantics.
Inferred defaults use the existing metadata selector and complete constructor dependency descriptors. Admission compares matching implementation identities, and closed factories supply executable services. Automatic metadata construction retains its ordinary dependency-injection boundary throughout the call chain; inferred default leaves participate in an existing closed transaction or start a transaction as a closed root. Typed and untyped codec/copier lookups use the actual closed service contract for admission. This preserves host startup dependencies such as the migration context's SerializerSessionPool while retaining transactional rollback for explicit graphs.
Concrete factories retain admission checks independently of which alias registration wins. Metadata bridges propagate child requirements, and type-dispatch wrappers follow the winning alias. Inferred codecs and copiers also yield to selected converter contracts, preserving custom array conversion priority. Closed generic source models specialize canonical constructor contracts, including generated activators marked with [GeneratedActivatorConstructor]. Explicit registrations retain their declared behavior. Closed canonical arrays, reference/value tuples, collection surrogates, value/base serializer aliases, and referenced generated activators supply the known construction graph.
The combined inferred response graph admits up to 1,024 closed executable types. RPC candidate and holder admission count that executable graph; explicit serializer contexts retain their separate metadata traversal limits. Aggregate failures report ORLEANS0116 in both managed and native builds while retaining holder declarations. Argument admission failures use argument-specific ORLEANS0116 guidance to register the argument's codec, copier, and serialization-service dependencies, including for one-way contracts.
Rebased onto main at b084e035b8ebcc7933f09515d09f2bf9fb7da776, containing #11382. Explicit serializer contexts and inferred RPC response graphs share the finalized graph collector, constructor inspection, provider-owned construction scopes, and metadata registration contracts. The message-oriented transport and documentation allowlist fix from #11401 are included. NativeAOT targets .NET 10+, with managed .NET 8 compatibility retained. Native coverage uses the shared project and centralized runner from #11367. Converter lookup consumes surrogate metadata captured during initialization, and .NET 10 multidimensional array allocation uses the concrete array type.
Published reconciled head: dd8576836fc2b247b37a44791666695aee5c051f. The rebase preserves concurrently published response-lease and rooted-materialization fixes. Draft remains held for fresh CI and final human review.
The newest successful coverage run tested dfd30e9, not current main ec48d17.
Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.
The comparison remains report-only while normal line and branch variance is calibrated.
An explicit closed dependency factory does not make an inferred parent graph ineligible. For example, AddSerializer<int>(customCodec, customCopier) replaces the generated IFieldCodec<int>/IDeepCopier<int> services, but the generated Response<int> factory constructs PooledResponseCodec<int, Int32Codec> and PooledResponseCopier<int, ShallowCopier<int>> from concrete canonical services. This loop treats the explicit dependency as satisfied, so GetCodec<Response<int>>() still selects that default and response serialization/copying bypasses the application's explicit factories. The holder's IsSupported check only forces the invocation fallback; it does not prevent the fallback Response<int> codec/copier from using the canonical children. Decline the inferred parent whenever a required canonical dependency has been replaced by an explicit service, unless the parent construction actually consumes that explicit service contract.
Record canonical service aliases independently of registration order and declare the exact services consumed by inferred factories. Preserve contract-aware parents and custom metadata precedence.
Emit RPC registrations unconditionally and retain managed/native/framework-symbol source parity.
Addressed the previously missed "Explicit child factories do not invalidate inferred parent services" feedback in e572455. Canonical implementation aliases now retain their service identity in either registration order, and generated dependency descriptors name the services each factory actually consumes. Parents which use canonical children yield to explicit child contracts; parents which consume those contracts directly remain admitted. This preserves custom metadata selection and applies to codec, copier, and activator aliases. RPC registrations are now emitted unconditionally, with parity checked for managed/native publishing and with/without NET5_0_OR_GREATER.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
It broadly changes generated serialization graphs, response ownership, filtering, pooling, and wire transport and remains held for fresh CI and final human review.
Share candidate constraint validation, source-known argument metadata, immutable response plans, and construction-driven registration emission. Remove redundant manifest maps and pair each closed factory with its service identity.
Centralize response copy/dispose ownership and raw reader adaptation while retaining typed/runtime dispatch, filter isolation, graph publication, and native-safe factory selection.
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
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.
Fixes #11375.
Native RPC response handling selected pooled codecs and copiers by closing open generic implementations at runtime. Generate concrete, non-generic response holders and closed construction graphs for source-known method results and proxy dependencies.
The generator emits identical invocation and registration code for managed and NativeAOT publishing. Closed factories participate through the common provider resolution pipeline, with application registration precedence selecting services in either execution mode. Full emitted-source parity is covered directly, including result models, collections, primitive responses, completion responses, and explicit serializer contexts.
Generated invokables implement
IResponseInvokable, isolate mutable results before incoming filters resume, and rent a successful holder with provider-owned dependencies. Incoming filters can transform the response envelope and nested references; the runtime copies their selected result for delivery. The invocation context owns every superseded filter response until completion, supports restoring earlier selections, and releases each unselected wrapper exactly once. Unfiltered calls transfer the invocation-time copy directly, and expired or one-way requests release the owned response.IRawResponseWriterwrites the existing raw protocol directly before the sender queries a response codec. ClosedIRawResponseReaderregistrations reconstruct holders from the wire result type. Primitive codecs, reference cycles, shared identity, pool reset, completion responses, exceptions, and custom implementation dispatch retain their established semantics.Inferred defaults use the existing metadata selector and complete constructor dependency descriptors. Admission compares matching implementation identities, and closed factories supply executable services. Automatic metadata construction retains its ordinary dependency-injection boundary throughout the call chain; inferred default leaves participate in an existing closed transaction or start a transaction as a closed root. Typed and untyped codec/copier lookups use the actual closed service contract for admission. This preserves host startup dependencies such as the migration context's
SerializerSessionPoolwhile retaining transactional rollback for explicit graphs.Concrete factories retain admission checks independently of which alias registration wins. Metadata bridges propagate child requirements, and type-dispatch wrappers follow the winning alias. Inferred codecs and copiers also yield to selected converter contracts, preserving custom array conversion priority. Closed generic source models specialize canonical constructor contracts, including generated activators marked with
[GeneratedActivatorConstructor]. Explicit registrations retain their declared behavior. Closed canonical arrays, reference/value tuples, collection surrogates, value/base serializer aliases, and referenced generated activators supply the known construction graph.The combined inferred response graph admits up to 1,024 closed executable types. RPC candidate and holder admission count that executable graph; explicit serializer contexts retain their separate metadata traversal limits. Aggregate failures report ORLEANS0116 in both managed and native builds while retaining holder declarations. Argument admission failures use argument-specific ORLEANS0116 guidance to register the argument's codec, copier, and serialization-service dependencies, including for one-way contracts.
Rebased onto
mainatb084e035b8ebcc7933f09515d09f2bf9fb7da776, containing #11382. Explicit serializer contexts and inferred RPC response graphs share the finalized graph collector, constructor inspection, provider-owned construction scopes, and metadata registration contracts. The message-oriented transport and documentation allowlist fix from #11401 are included. NativeAOT targets .NET 10+, with managed .NET 8 compatibility retained. Native coverage uses the shared project and centralized runner from #11367. Converter lookup consumes surrogate metadata captured during initialization, and .NET 10 multidimensional array allocation uses the concrete array type.Published reconciled head:
dd8576836fc2b247b37a44791666695aee5c051f. The rebase preserves concurrently published response-lease and rooted-materialization fixes. Draft remains held for fresh CI and final human review.Microsoft Reviewers: Open in CodeFlow