Document multiple client proxy patterns#1470
Merged
Merged
Conversation
Add comprehensive documentation and working examples for the three patterns to construct multiple client proxies over a single JSON-RPC connection: 1. Create one proxy implementing multiple interfaces at once 2. Create JsonRpc first, then call instance Attach<T> multiple times 3. Create the first proxy with static Attach<T>, extract the JsonRpc instance through IJsonRpcClientProxy, then call instance Attach<T> This addresses the common mistake of calling static Attach<T> multiple times on the same stream (which creates multiple distinct JsonRpc instances that cannot safely share one transport). Includes code samples in samples/Proxies.cs with dedicated regions for each pattern and reference documentation in docfx/docs/proxies.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds documentation and sample code showing the supported ways to create multiple strongly-typed client proxies over a single StreamJsonRpc connection, avoiding the common mistake of calling static JsonRpc.Attach<T> multiple times on the same stream.
Changes:
- Added a new “Multiple proxies on one connection” section to the proxies documentation with guidance and snippet references.
- Added sample code regions demonstrating three supported multi-proxy patterns (multi-interface proxy, multiple instance
Attach<T>calls, and extractingJsonRpcfrom an existing proxy).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docfx/docs/proxies.md | Documents the supported multi-proxy patterns and links to corresponding sample snippets. |
| samples/Proxies.cs | Provides the code examples (with #region markers) used by the documentation. |
Rename multi-proxy sample regions to MultipleProxiesPattern1/2/3 and update doc snippet anchors so the documented pattern order matches the sample region naming. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
RyanToth3
approved these changes
Jun 23, 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.
Summary
Users often attempt to call static
JsonRpc.Attach<T>multiple times on the same stream to create multiple client proxies. This is a common mistake that leads to failures because each static call creates a distinctJsonRpcinstance, and multiple instances cannot safely share one transport.Changes
This PR documents the three supported patterns for constructing multiple client proxies over a single JSON-RPC connection, with working code examples:
Create one proxy implementing multiple interfaces at once
Create
JsonRpcfirst, then call instanceAttach<T>multiple timesExtract
JsonRpcfrom the first proxy usingIJsonRpcClientProxyFiles Changed
#regionmarkers for documentationAll samples compile and pass tests.