-
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
Add RPC marshaling support for custom interfaces #777
Conversation
src/StreamJsonRpc/Reflection/MessageFormatterRpcMarshaledContextTracker.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. It's exciting to see this come together so quickly.
Codecov Report
@@ Coverage Diff @@
## main #777 +/- ##
==========================================
+ Coverage 91.69% 91.87% +0.17%
==========================================
Files 61 61
Lines 5323 5342 +19
==========================================
+ Hits 4881 4908 +27
+ Misses 442 434 -8
Continue to review full report at Codecov.
|
src/StreamJsonRpc/Reflection/MessageFormatterRpcMarshaledContextTracker.cs
Outdated
Show resolved
Hide resolved
8ab5d80
to
3570d33
Compare
3570d33
to
fa1f68d
Compare
src/StreamJsonRpc/Reflection/MessageFormatterRpcMarshaledContextTracker.cs
Show resolved
Hide resolved
src/StreamJsonRpc/Reflection/MessageFormatterRpcMarshaledContextTracker.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good. Just a few touch-up suggestions.
…ft/vs-streamjsonrpc into dev/maprospe/marshalable
…ng capabilities (#783) Addressing failures similar to ``` StreamJsonRpc.RemoteMethodNotFoundException : Unable to find method 'xxx' on {no object} for the following reasons: Deserializing JSON-RPC argument with name "observer" and position 1 to type "xxx" failed: Could not create an instance of type xxx. Type is an interface or abstract class and cannot be instantiated. Path 'params[1].__jsonrpc_marshaled'. ``` when calling APIs under the following conditions: - using Newtonsoft.Json - the API has marshalable (`IObserver<>`, `IDisposable` or interfaces with `RpcMarshalableAttribute`) objects as parameters or return values - the user replaces `JsonMessageFormatter`'s `ContractResolver`. This issue has worsened since #777 due to more behavior being delegated to the `ContractResolver` This PR integrates the `ContractResolver` provided by the user with `MarshalContractResolver` before the first serialization or deserialization.
This PR addresses #774.
I added the
RpcMarshalable
attribute that can be applied to an interface thatIDisposable
I added unit tests and docs.