If you open the “Screwdrivers” window of the debugger, you will see that for each thread there is a flag “Only my code”. I found that if you set the flag only for the current thread that you are passing, the Step into ( F11 ) and Step over ( F10 ) functions seem to target only that thread. Although this is for native threads, it works just as well for thread-driven code.
However, the functionality can be quite fragile if you are not careful - breakpoints will still break for any thread (unless the breakpoint is filtered only for the thread of interest). And if another thread is in the middle of the stage before setting this flag, this thread can still “interact” with the debugger when you try to go through the current thread. Therefore, when using this function, you need to carefully manage your breakpoints.
However, everything is in order, it seems to work very well.
Please note that I find the terminology rather confusing, since “Just My Code” is also used to describe the debugger’s controlled function for installing the debugger, so as not to disturb the transition to “non-user” code (which is controlled by method attributes). The “Just My Code” thread is something else, and I really can't find much documentation information ( Like: Flag and Unflag Threads ). This specific behavior of single thread targeting for stepping does not seem to be mentioned - I accidentally stumbled upon it.
source share