Skip to content

Add RpcTargetMetadata generation from ITypeShape#1251

Merged
AArnott merged 2 commits intomainfrom
dev/andarno/shapeToMetadata
Aug 18, 2025
Merged

Add RpcTargetMetadata generation from ITypeShape#1251
AArnott merged 2 commits intomainfrom
dev/andarno/shapeToMetadata

Conversation

@AArnott
Copy link
Copy Markdown
Member

@AArnott AArnott commented Aug 17, 2025

This allows for creating RPC targets for any type for which a PolyType shape is available, such that it's safe in a trimmed app without a dynamic runtime (e.g. NativeAOT).

This is an important prerequisite for the NerdbankMessagePackFormatter to be able to support RPC general marshable objects, as they become RPC targets in an almost unpredictable fashion.

@AArnott AArnott added this to the v2.23 milestone Aug 17, 2025
@AArnott AArnott requested a review from Copilot August 17, 2025 23:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for generating RpcTargetMetadata from ITypeShape objects, enabling RPC target creation for types with PolyType shapes. This functionality is essential for supporting trimmed applications and NativeAOT scenarios where dynamic runtime reflection is not available.

Key changes:

  • Adds new FromShape methods to generate RPC metadata from type shapes
  • Refactors TargetMethodMetadata to support shape-based construction
  • Updates method references from Method to MethodInfo for clarity

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
RpcTargetMetadata.cs Core implementation of shape-based metadata generation with new FromShape methods
RpcTargetMetadataTests.cs Test coverage for the new shape-based functionality
TargetMethod.cs Updates method property references to use new MethodInfo property name
RpcTargetInfo.cs Updates method creation call to pass null shape parameter
ProxyGeneration.cs Updates method property reference to use new MethodInfo property name
PublicAPI.*.txt API surface updates for the new methods and property changes
StreamJsonRpc.csproj Enables format methods for embedded resources
Resources.resx Adds error message for missing AttributeProvider
Directory.Packages.props Adds PolyType package dependency

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread src/StreamJsonRpc/RpcTargetMetadata.cs
Comment thread src/StreamJsonRpc/RpcTargetMetadata.cs
@AArnott AArnott marked this pull request as draft August 18, 2025 04:05
@AArnott AArnott marked this pull request as ready for review August 18, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants