WCF client will hung if consume NettcpBinding service with Async then sync #4946
Description
Repro :
- Create WCF NettcpBinding target with 481
- Create WCF client target with .netcore6.0 or higher
- Call the servcie from client project like below:
Console.WriteLine($"Get async result:{await client.HelloAsync("helloworld")}");
Console.WriteLine($"Get sync result:{client.Hello("helloworld")}");
if the client target with full framework481, issue not repro
Expected Results:
we can get both the msg in the output
Actual Results
only get the Async result output
Timeout Exception:
Unhandled exception. System.TimeoutException: This request operation sent to net.tcp://localhost:8089/nettcp did not receive a reply within the configured timeout (00:04:59.9980591). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.
at System.ServiceModel.Dispatcher.DuplexChannelBinder.SyncDuplexRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
--- End of stack trace from previous location ---
at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
at generatedProxy_1.Hello(String )
at NetCoreClient.Program.Main(String[] args) in F:\NetTcpIssue\NetCoreClient\Program.cs:line 20