c # – How to follow the execution path of a Unit Test in real time without manually going through the code line by line?


I am using MSTest. I have some asynchronous functions that I am testing in units that depend on many different methods in which the result must be expected. Sometimes, unit tests stall in a "functioning" stage for a long time and I am trying to determine which blocking operations are taking longer.

The solutions I can think of are:
1] Manually going through the code line by line. This is practically not possible since I am using loops on the same blocking operations that sometimes happen instantaneously, sometimes they take much longer. Loops can contain thousands of iterations with different variables, so it is not feasible to perform a "manual debug line by line".

2] Establish a waiting time for each blocking operation that, if reached, will enter a conditional code block with a breakpoint, so that you can immediately see the entire status of the program that led to the blocking operation That expired.

Option 2 does exactly what I need, however, it would require extensive refactoring and, in reality, functionality is not necessary for anything other than this debug test. I was wondering if there was an integrated solution in Visual Studio, Jetbrain Rider or some other IDE or complement that would allow me to see in real time the debugger that runs each line without having to manually click on "Pass over" each line segment ? I understand that I could never "catch" the deugger by moving in this way, so to speak, since it would move quickly, unless, of course, it was locked somewhere for a long time, at which point I could see exactly what You are stopping without requiring a custom write timeout logic for each blocking operation.

Is there something like this?