You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per our investigation with @AArnott the following test fails when using MessagePack or Newtonsoft formatters because IAsyncEnumerable formatter created for GetAsync method is cleaned up early when client.DoSomethingAsync() method returns.
What happens is that request id for "server.GetAsync" that is attached to IAsyncEnumerable ends up being same as request id for "client.DoSomethingAsync()" and response of DoSomethingAsync ends up cleaning up the enumerable formatter before enumerable is finalized.
publicclassAsyncEnumerableTests{[Fact]publicasyncTaskTest(){varpair=FullDuplexStream.CreatePair();varserverHandler=newLengthHeaderMessageHandler(pair.Item1.UsePipe(),newMessagePackFormatter());varclientHandler=newLengthHeaderMessageHandler(pair.Item2.UsePipe(),newMessagePackFormatter());JsonRpcjsonRpcClient=newJsonRpc(clientHandler);JsonRpcjsonRpcServer=newJsonRpc(serverHandler,newServer());IServerserver=jsonRpcClient.Attach<IServer>();jsonRpcServer.StartListening();jsonRpcClient.StartListening();// uncomment the following code to fix the test.// await server.StartAsync();awaitforeach(varsinserver.GetAsync(newClient())){}}}publicinterfaceIServer{IAsyncEnumerable<string>GetAsync(IClientclient);TaskStartAsync();}[RpcMarshalable]publicinterfaceIClient:IDisposable{TaskDoSomethingAsync();}publicclassClient:IClient{publicTaskDoSomethingAsync(){returnTask.CompletedTask;}publicvoidDispose(){}}publicclassServer:IServer{publicasyncIAsyncEnumerable<string>GetAsync(IClientclient){// make a request from server to client, if this ends up with // same request id that called this method IAsyncEnumerable formatter will be cleaned up earlyawaitclient.DoSomethingAsync();yieldreturn"Hello";}publicTaskStartAsync(){returnTask.CompletedTask;}}
The text was updated successfully, but these errors were encountered:
Per our investigation with @AArnott the following test fails when using MessagePack or Newtonsoft formatters because IAsyncEnumerable formatter created for
GetAsync
method is cleaned up early whenclient.DoSomethingAsync()
method returns.What happens is that request id for "server.GetAsync" that is attached to IAsyncEnumerable ends up being same as request id for "client.DoSomethingAsync()" and response of DoSomethingAsync ends up cleaning up the enumerable formatter before enumerable is finalized.
The text was updated successfully, but these errors were encountered: