Skip to content

Use PolyType shapes for events - #1297

Merged
Andrew Arnott (AArnott) merged 5 commits into
feature/polytypefrom
dev/andarno/eventShapes
Oct 2, 2025
Merged

Use PolyType shapes for events#1297
Andrew Arnott (AArnott) merged 5 commits into
feature/polytypefrom
dev/andarno/eventShapes

Conversation

@AArnott

Copy link
Copy Markdown
Member

Use PolyType shapes for events

This avoids the need for RpcTargetMetadata.RegisterEventArgs<T>() so long as you construct an RpcTargetMetadata based on PolyType shapes.

Closes#1280

Drop mutable, idempotent statics from RpcTargetMetadata

This means more APIs have [RequiresDynamicCode] on them, but these APIs have better alternatives based on PolyType shapes.

The problem with the old design was that an entire process (or AppDomain) would succeed based on any one party calling RegisterEventArgs<T>() or EnableDynamicEventHandlerCreation(), causing libraries to potentially rely on another party to call those APIs without realizing it, and then malfunctioning when the other code was removed.
With the new design, code will more reliably either succeed or fail on its own merits.

Closes#1275

This avoids the need for `RpcTargetMetadata.RegisterEventArgs<T>()` so long as you construct an `RpcTargetMetadata` based on PolyType shapes.
Closes#1280 (because some commit in this branch needs to)
This means more APIs have `[RequiresDynamicCode]` on them, but these APIs have better alternatives based on PolyType shapes.
The problem with the old design was that an entire process (or AppDomain) would succeed based on any one party calling `RegisterEventArgs<T>()` or `EnableDynamicEventHandlerCreation()`, causing libraries to potentially rely on another party to call those APIs without realizing it, and then malfunctioning when the other code was removed.
With the new design, code will more reliably either succeed or fail on its own merits.
Closes#1275
@AArnott
Andrew Arnott (AArnott) marked this pull request as draft September 23, 2025 12:51
auto-merge was automatically disabled September 23, 2025 12:51

Pull request was converted to draft

@AArnott
Andrew Arnott (AArnott) marked this pull request as ready for review October 2, 2025 17:37
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@AArnott@RyanToth3