Some times you have a component, e.g. HttpClient
, which offers only asynchronous methods.
That's fine when you can go "all the way up" to an async event handler or an async action method cause to my understanding the execution is returned to the IIS pipeline, for example, that can continue to run other things.
When you cant go "all the way up" you have to do something like .Result
at some point.
My case is a windows service hosting a WCF service which uses HttpClient
to get some data from an API. My code is in a method bound by an Interface that cannot be changed and makes no sense to be changed because the application manages threads already, directly without tasks.
In that case, is it better to go "all the way up" as much as you can and finally block or block the async method straight away and save the complexity and resources of saving and resuming (awaiting) all the way to the top for what seems like no reason?