Scott Hanselman

Multi-threaded Debugging in Visual Studio 2008

September 21, '07 Comments [4] Posted in ASP.NET | Microsoft | Programming
Sponsored By

This might be old news but it was a treat for me. In debugging some multithreaded code recently got to use the improved debugger support for threads in Visual Studio 2008 (I'm running Beta 2) that John Robbins blogged about last month and Soma blogged last week.

Take a look at the IDE screenshot below (click to Zoom).

Multi-threaded Debugging

There's a few cool and subtle things going on here. Take a look at the current instruction location in yellow. It's right at the end of the CheckDependancyCallback method - but see the gray highlight with the squiggly "thread" in the margin? That's the current location of another thread of execution.

You can name your threads now just by entering their name in the Threads toolbox window, and some threads without names will get an automatic name. You can also flag threads you're interested in watching so you don't have to remember the Thread ID.Take a look at the Debug toolbar as well. You can see the Debug Location including Process and Thread (what thread I'm currently debugging).

What a treat.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Saturday, 22 September 2007 05:11:41 UTC
I'm looking forward to using these features in VS 2008!
Saturday, 22 September 2007 18:44:13 UTC
Nice. Thanks for the info, Scott. One of my biggest annoyances with VS 2005 was the inability to easily tell one thread from another in the Threads dropdown.
Saturday, 22 September 2007 22:58:58 UTC
That is cool!

Shouldn't you be checking for a null condition on CacheDepends? ;)
Chris Martin
Sunday, 23 September 2007 01:40:44 UTC
ChrisM - Who else could possibly be calling my callback? ;)
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.