-
Notifications
You must be signed in to change notification settings - Fork 5
Remote client result does not work. #14
Copy link
Copy link
Closed
Description
Calling client with the following code will result in an exception.
var groupProvider = new RemoteGroupProvider(
DynamicInMemoryProxyFactory.Instance,
DynamicRemoteProxyFactory.Instance,
new TestJsonRemoteSerializer(),
new RemoteClientResultPendingTaskRegistry());
using var group = groupProvider.GetOrAddGroup<int, IReceiver>("name");
await group.AddAsync(0, new Receiver(100));
var receiver = group.Single(0);
// Throws System.NotSupportedException: 'In-memory proxy does not support to invoke multiple receivers.'
var x = await receiver.NotifyAsync().ConfigureAwait(false);
Console.WriteLine($"Received: {x}");
public interface IReceiver
{
Task<int> NotifyAsync();
}
class Receiver(int value) : IReceiver
{
public Task<int> NotifyAsync()
{
Console.WriteLine("Notify");
return Task.FromResult(value);
}
}I think it is because _targets in InMemoryProxyBase is null.
Multicaster/src/Multicaster/InMemory/InMemoryProxyBase.cs
Lines 551 to 557 in cdee96e
| private void ThrowIfNotSingle() | |
| { | |
| if (_targets is not { Length: 1 }) | |
| { | |
| throw new NotSupportedException("In-memory proxy does not support to invoke multiple receivers."); | |
| } | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels