Debugger Canvas in Visual Studio 2010; A New Debugging Tool


Introduction

Tool Release Date: Jun 15 2011

This article explains about a new powerful debugging tool introduced in Visual Studio 2010 Ultimate called Debugger Canvas

A new debugging tool in the debugger for Visual Studio users is used to debug code when stepping through each line of code

It pulls together the code you want to debug onto a single block or canvas or a new term bubbles with zoom display. 

When you hit (F5) and set breakpoints (F9) or step into code (F8/F10), Debugger Canvas shows just the methods or functions 

that you're debugging even with call lines and local variables. It will be a new user experience, I liked it J

a new refreshing tool introduced by Microsoft. Debugger Canvas was built on top of Visual Studio 2010 Ultimate.

 
Prerequisites


Why only Visual Studio 2010 Ultimate
 

As per MSDN Forums:

"The reason we require Ultimate is so that we could re-use the underlying technology for the Dependency Diagrams 

  to identify and display the right fragments on the canvas."


I yet to explore Dependency Diagrams, hope MSDN link provided above will help you.


Another important thing I observed is that the tool only supports code files, no designers or other external files other than code files.

 

Features of Debugger Canvas

  • Am sure you all going to love these features.
  • A new rich debugging experience.
  • A new interface named Canvas or bubble window.
  • Instead of breaking each code file where the methods resides, a new code bubble window with all methods will get opened.
  • While stepping through the code Debugger Canvas will open each method in a new code window.
  • Each new code bubble window will open an editor window the same as code behind files.
  • We can edit the code logic on runtime directly on canvas.
  • We have call stack, local variables, can set breakpoints through debugging window.
  • We can set or save each line variable values and compare with old one etc and more.


Getting StartedDownload the .vsix Visual Studio 2010 Extension file from the above link. Just double-click on the Microsoft.DebuggerCanvas.vsix installation file.


11.jpg

22.jpg

You can check the successful installation of extension by opening Extension Manager from Tools menu. We can even disable or uninstall the file from listings.

33.jpg

And also, go to Debug menu and Debugger Canvas.

44.jpg

Now restart you Visual Studio and create a console application.

 

Example 1

Follow this simple sample code which prints Hello World!Program.cs


55.jpg

Now put a break point on line number 13 and F5. Start debugging the code by pressing F8/F10 according to VS keyboard settings on your system. 

Now you will see a new code bubble window open like below.

66.jpg

Further debugging will open a new code bubble window with Display method. Hit F5 to run for the output.

77.jpg

Example 2

Let's work with another sample. Introduce a new code file which returns a simple string value.CodeFile1.cs


88.jpg

Program.cs

99.jpg

Put a breakpoint on line number 10, run the project and start debugging line by line until the output displays. The newly generated Canvas will look like below.

111.jpg


Edit the code on runtime


Go to Tools --> Options --> Debugger --> Debugger Canvas, then enable the check box to allow editing.

444.jpg  

Now how to edit the code on runtime, it's simple by just clicking on any bubble editor window and change the code and re-run the project.

222.jpg

After clicking on the above icon to expand, we can see the values for variables at different timings (click on camera icon).

333.jpg

Conclusion

Hope this article helps you all in understanding Debugger Canvas in Visual Studio 2010 Ultimate. 


More articles are coming on this topic so keep checking for my next one. 

Sample code is attached, try at your end and let me know the experience of using this powerful tool. 

Keep commenting and rate the article.

Thank You !

Up Next
    Ebook Download
    View all
    Learn
    View all