Given that async / await doesn't inherently create a thread and the awaited I/O operation is completed outside of a thread's context, how is one supposed to determine what operations are currently being executed?
To experiment, I put together a small test app which would fire off 1 long-running IO operation and awaited it. I ran the test program and during the the long running IO operation, created a dump file and inspected the threads using WinDbg
. Nowhere within the thread stacks was it clear (to me at least) of that awaited call. I didn't see any of my .Net code, I didn't see any class references of the library I was calling (Amazon in this case).
I tried the same thing, but fired off 3 long-running IO operations all at the same time and awaited them. I created another dump file. My threads and stack traces look nearly identical.
How are situations like this debugged? How would I determine what is "running" right now when my app basically appears to look like its idle in terms of its thread's call stacks? The closest solution I've come up with is to inspect the heap and look for objects I know would be allocated during that awaited operations and see how many exist. (i.e. 3 WebRequest
objects, etc.)
Surly there is a better method to this!