Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Async method hanging the second time it is called

$
0
0

I have converted my code as much as possible line for line from old asp.net to .net core.

One piece of code is not working and I think it is because a deadlock is happening on an async method call.

Translating the code directly from its previous equivalent, the code is like this:

//loop at this level - many health checks to carry out

try

{

    bool result = await healthCheckable.GetHealthAsync(); 

}

catch(Exception ex)

{

   

}

 note that an exception is raised each time the healthcheck code is executed in this scenario as a service is down.

The first time around the loop the exception is caught correctly, the second time around, the code simply hangs on the healthservice check.

 I have tried .Wait() and I have tried .Result;  and I have tried ConfigureAwait(false) - all the way up the call tree

At this point I have no clue what to try next.. help?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>