It must be my week of discovering the obvious. The other day I was troubleshooting a race condition in my code. I had a unit test that faithfully reproduced the error, but just looking at the code involved didn't produce any sudden insights into its reasons. The nasty thing about race conditions (and multi-threaded code in general) is that you can't debug them, since the debuger influences the race.
Sometimes, you can troubleshoot race conditions by tracing strategic points in the code, and sometimes it doesn't work, since even tracing statements influence the race. In my particular case, tracing didn't disrupt my race condition, so the only problem left was how I could view that output as easily as possible. Since I was using VSTS unit tests from within Visual Studio 2005, I was hoping my Console output would be in the Output window, but no such luck. Then, in a rare case of inspiration, I double-clicked on the test in the Test Results window and got a window similar to this one (which is a mock-up, I admit):
Notice the highlighted Standard Console Output.
It's so simple that I wonder I never discovered this feature before, but now that I know it exists, I know how to troubleshoot race conditions reproduced in unit tests the next time I have to deal with multi-dreaded code 🙂