-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make support for marshaled objects available for custom types #774
Comments
The place to start investigation of this feature is probably here: vs-streamjsonrpc/src/StreamJsonRpc/Reflection/MessageFormatterRpcMarshaledContextTracker.cs Line 23 in 114ee4f
This line (and the surrounding array) is what controls which types will get marshaled instead of serialized. At the moment this is a static list. I believe the static list should remain, but any use of that list may be augmented with another list that is maintained on a per-JsonRpc instance basis, or perhaps by checking for an attribute on the interface being tested. I think we should start with requiring any additional interfaces to derive from |
This PR addresses #774. Added the `RpcMarshalable` attribute that can be applied to an interface that: - extends IDisposable, - doesn't have properties, - doesn't have events. See https://github.com/microsoft/vs-streamjsonrpc/blob/main/doc/rpc_marshalable_objects.md for more information. Co-authored-by: Matteo Prosperi <[email protected]> Co-authored-by: Andrew Arnott <[email protected]>
Could you please consider making marshaled object support available for custom interfaces?
The goal would be to allow an RPC interface to expose APIs like
The caller would call
await GetSomethingAsync()
and receive a disposable proxy of anIFoo
object.The caller would call
await GiveSomethingAsync(bar)
and the server would receive a disposable proxy for thebar
object.Calls to methods exposed by the
IFoo
andIBar
proxies would result in RPC calls and the corresponding method being executed on the corresponding object.The receiver of a marshaled object will be responsible for disposing of the proxy. I am not sure if it should be mandatory for interfaces that are marshaled as objects to be
IDisposable
(i.e.,interface IFoo : IDisposable
andinterface IBar : IDisposable
).This feature request doesn't cover any other members other than methods (e.g. properties), I don't have a use case for that.
Thanks
The text was updated successfully, but these errors were encountered: