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
Describe the bug
When I call a sync WCF OperatinContract after an async OperationContract call with no result the synchron call is never resolved. If the perverious async call has a result this problem does not happen.
To Reproduce
Create a WCF Service with Async Methods that returns somsthing (Test1Async) and one that returns nothing (Test2Async) and add a sync Method (Test3)
Call the WCF Interface (see code below with comments)
privatestaticasync Task CallNetPipeBinding(stringhostAddr){IClientChannelchannel=null;varbinding=new NetNamedPipeBinding();varfactory=newChannelFactory<ITestService>(binding,new EndpointAddress($"{hostAddr}/netPipe"));await Task.Factory.FromAsync(factory.BeginOpen, factory.EndOpen, TaskCreationOptions.None);try{ITestServiceclient= factory.CreateChannel();channel= client as IClientChannel;await Task.Factory.FromAsync(channel.BeginOpen, channel.EndOpen, TaskCreationOptions.None);await client.Test1Async("Test");
client.Test3("Test");// This call works because the perverious call returns somethingawait client.Test2Async("Test");
client.Test3("Test");// This call does not work becausee the pereverious call returns nothing}finally{
factory.Close();}}
Expected behavior
Synchron calls after async call with no result don't block forever.
Additional context
I think the problem is that the TaskCompletionSource withtout result is not created with TaskCreationOptions.RunContinuationsAsynchronously
I believe this is the explanation of what's going on along with a workaround if you can't upgrade to a fixed version. #4946 (comment)
Basically you do this:
await client.Test1Async("Test");
client.Test3("Test");// This call works because the perverious call returns somethingawait client.Test2Async("Test");await Task.Yield();
client.Test3("Test");// This call does not work becausee the pereverious call returns nothing
I tested it with the NuGet Packages Version 8.0.0 and with a local build of the master branch witch is less then a month old.
The Example in #4946 (comment) only uses Tasks with a result Task<T> and this works without any problems for me. But if my Task does not have a result Task is doesn't work.
Describe the bug
When I call a sync WCF OperatinContract after an async OperationContract call with no result the synchron call is never resolved. If the perverious async call has a result this problem does not happen.
To Reproduce
Create a WCF Service with Async Methods that returns somsthing (Test1Async) and one that returns nothing (Test2Async) and add a sync Method (Test3)
Call the WCF Interface (see code below with comments)
Expected behavior
Synchron calls after async call with no result don't block forever.
Additional context
I think the problem is that the TaskCompletionSource withtout result is not created with
TaskCreationOptions.RunContinuationsAsynchronously
TaskCompletionSource Creation with return Type:
wcf/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs
Line 318 in c7b4036
wcf/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs
Line 174 in c7b4036
TaskCompletionSource Creation without return Type:
wcf/src/System.ServiceModel.Primitives/src/System/ServiceModel/Channels/ServiceChannelProxy.cs
Line 213 in c7b4036
The text was updated successfully, but these errors were encountered: