HttpClient.PostAsync disappears and doesn’t return … ?

Found the following (from 2014!!) after banging my head against the wall for 3×4 hours …. in 2 projects.  This explains a lot and I am not sure that all developers are aware of this deadlock? Or am I the only one? 🙂 So back to work!!


Ok, discovered the answer the hard way after 2 days of tracing and breakpointing. In a nutshell, you can’t call an asynchronous method

await asyncmethod2()

from a method that blocks


as it causes a deadlock to occur when method2 attempts to return execution to the caller.


… and so, I decided to refresh my Task thinking with this excellent beginners guide to threading in c#. Good stuff.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s