codethinked (kōdthĭngked) adj. To be consumed by or obsessed with code.

Visual Studio 2008 New Multi-Threaded Debugging Feature

So, I was working in Visual Studio 2008 today (yeah, I know what you are thinking. I am pretty fancy) and I noticed this little bugger…

ThreadButtonUp

Hmmmm, my first thought was that it was the “add wavy lines” feature that I had been hearing so much about. So I clicked it. I mean, who wouldn’t want to add some nice wavy lines to their software? To my dismay though, this is all that happened:

ThreadButtonDown

You see? No wavy lines, it just was now highlighted. But in doing so I inadvertently hovered over it a little too long.

ThreadButtonToolTip

Ooooh, it is just for threads. Not quite as sexy, but still pretty cool. So I decided to wade in a little bit…

I quickly slapped together this amazingly clever little program:

static void Main(string[] args)
    {
      Thread newThread = null;
      for (int i = 0; i < 10; i++)
      {
        newThread = new Thread(new ThreadStart(CallMe));
        newThread.Name = "Thread" + i.ToString();
        newThread.Start();
      }
      newThread.Join();
    }
 
    public static void CallMe()
    {
      Thread.Sleep(1000);
 
      Thread.Sleep(1000);
 
      Thread.Sleep(1000);
 
      Thread.Sleep(1000);
 
      Thread.Sleep(1000);
 
      Thread.Sleep(1000);
 
      Thread.Sleep(1000);
    }

So, with this feature enabled I can now step through this program and I see each thread and what line it is currently on. In fact, if there is more than one thread on a line you will see a little plus sign next to the wavy lines:

MultipleThreads

Pretty cool. And as you can see in the program I am naming each one of these thread, so I can hover over one of these little wavy line icons and this shows up:

ThreadHover

This will let me see which threads are currently on that line. How cool is that? If I right click on the icon then a little menu pops up (which I am having a hard time getting a screenshot of) that lets me either flag or switch to one of the threads on the current line. This will let me quickly switch to a particular thread, or flag a thread for easy identification. This especially comes in handy when combined with the threads window:

 ThreadsWindow

Now we can flag a thread and then see which thread we are dealing with in the threads window. These features are really great for allowing you to track threads, freeze threads, and in general just deal with multi-threaded debugging in a much more pleasurable way than in Visual Studio 2005. Cheers!

Comments

trackback

Trackback from Trumpi's blog

Our daily link (2008-01-12)

Trumpi's blog

January 12. 2008 19:16

pingback

Pingback from blog.cwa.me.uk

Reflective Perspective - Chris Alcock  » The Morning Brew #9

blog.cwa.me.uk

January 14. 2008 05:57

trackback

Trackback from DotNetKicks.com

Visual Studio 2008 New Multi-Threaded Debugging Feature

DotNetKicks.com

January 17. 2008 11:49

pingback

Pingback from alvinashcraft.com

» Daily Bits - January 18, 2008 Alvin Ashcraft’s Daily Geek Bits: Daily links plus random ramblings about development, gadgets and raising rugrats.

alvinashcraft.com

January 18. 2008 11:52

Regev Porat

Nice one - thanks.

Regev Porat

January 20. 2008 07:47

Israel
pingback

Pingback from code-inside.de

Wöchentliche Rundablage: .NET 3.5, WPF, LINQ, Tests, System.AddIn, SubSonic, Sandcastle | Code-Inside Blog

code-inside.de

January 21. 2008 18:45

Ed

Finally, the MTD is here!

Ed

February 25. 2008 20:20

United States
trackback

Trackback from gOODiDEA

Interesting Finds: 2008.01.13

gOODiDEA

March 3. 2008 23:48

Mark O'Connor

If you liked that, you'll love the parallel debugging add-in for Visual Studio 2008 we've just released - Allinea DDTLite. Fair disclosure: I work for Allinea, but I still think it's pretty neat Smile If you're interested, there's a free 30-day trial version you could check out (www.allinea.com/ddtlite). It'd be good to hear how you get on!

Mark O'Connor

September 25. 2008 11:22

Add Comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading