Scott Hanselman

Multi-threaded Debugging in Visual Studio 2008

September 21, 2007 Comment on this post [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
Hosting By
Hosted in an Azure App Service
September 22, 2007 5:11
I'm looking forward to using these features in VS 2008!
September 22, 2007 18:44
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.
September 22, 2007 22:58
That is cool!

Shouldn't you be checking for a null condition on CacheDepends? ;)
September 23, 2007 1:40
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.