-
Notifications
You must be signed in to change notification settings - Fork 151
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
AddRemoteRpcTarget doesn't work with methods returning IAsyncEnumerable #791
Comments
The |
I cannot think of an option that would work fully with a mix of local and remote targets and overlapping IDs. Another option would be to allow (when multiple targets are supposed to be supported) to add a prefix to ids of async enumerables, |
That wouldn't be enough. The constraint would have to be that there is exactly one remote target, since more than one remote target would recreate the same ambiguity problem.
What do you mean
Well, that's another discussion. There is no support for intercepting messages today except by adding a local target object as well as the remote one, and having the local target object 'forward' messages by calling another JsonRpc object. And that would not work with your proposed 'only one remote target' idea.
Sure, but the creator of the async enumerable would have to know the prefix, and the receiver would have to know it too in order to forward calls to the right one. So they'd have to agree on the prefix somehow, which isn't currently in the protocol. Not impossible, but challenging. I guess we could do a very contrived thing here, which is to teach the middle-man the schema of each message enough that it can find the IDs in order to mutate them (and later route the messages sent to $/enumerable). But as this is probably a more general problem with the general object marshaling protocol as well, I think if we improve remote target objects support to deal with this, it should be a comprehensive fix. |
Here's an idea: we could add a setting to |
For reference this is an IProgress log
And the corresponding IAsyncEnumerable log.
|
Interesting. I can't remember if there is a good reason for the difference in behavior, but silently ignoring based on an unrecognized token seems ... questionable. |
When using
AddRemoteRpcTarget
to forward messages to anotherJsonRpc
instance, calling methods that return anIAsyncEnumerable
fails.This is because JsonRpc.rpcTargetInfo.TryGetTargetMethod will always return a match for the special methods that are used to implement the async enumerable support.
This can easily be reproduced with the following code:
The text was updated successfully, but these errors were encountered: