dotnet / wcf

This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.
MIT License
1.71k stars 559 forks source link

dotnet-svcutil cancellation token #5461

Open DefaultUser1606 opened 7 months ago

DefaultUser1606 commented 7 months ago

dotnet-svcutil tool generates asynchronous client code that doesn't accept cancellation tokens. Calling these generated methods becomes problematic inside a cancellable task or thread in .Net 6. We can't just abort a thread anymore in netcore.

I know it's not a valid direct comparison, but swagger c# client generator produces client code with versions of methods that accept cancellation tokens, which allows the caller to abort a request mid-execution in a responsive way.

Is there a possibility that cancellation tokens will be supported by dotnet-svcutil generated code in the future? If not by default then maybe through some optional parameter.

Leonardo-Ferreira commented 3 weeks ago

same issue here... this is quite problematic because:

  1. at the client side we end up "fire-and-forgetting" these requests, but under the hood they are still alive, consuming bandwidth, resources, and etc...
  2. at the server side, it keeps working as if the client is still interested at the result! and some requests are quite heavy