How can I check if an await
ed Async
method is running or not?
I want to create a timer that checks an awaited Async method some time after the Async was called. It will check whether it's still running or whether it had something like an OutOfMemoryException
which will not be caught by a try-catch
in the caller method - the call will never return.
EDIT
This async method might be awaited by another async method, and so on. Is there a way to check if the top async contains any asyncs that will never return?
(I'm trying to test it now, but am having a hard time creating an exception that will not be caught. I tried creating a StackOverflowException but it was caught by Visual Studio. Perhaps because it's my code, not some built-in async.)