Saturday, 26 May 2012

.NET Debugging in Visual Studio 2010

Everyone involved with .NET programming know how to use the basics of the powerful debugger available in Visual Studio 2010. It is pretty easy to use and very useful. However, very few people explore all the tools available and sometimes you can be very surprised to discover something truly amazing that you was completely unaware of. This post want introduce some of that things.

Show Next Statement

When you are in the middle of a debugging session it can be easy to get lost. You can switch back to the next statement using the "Show Next Statement" option.


Debugging .NET Code

You can debug the .NET Framework code. You need to check "Enable .NET Framework source stepping" and "Enable source server support." in the debugging options and you need to add a specific symbol file server.



Pinning the Data Tips
Everyone know that when you hold the mouse on a variable during the debugging you can explore the value inside a data tip. However, nobody knows (me included), that this data tip can be pinned. This is very useful in some circumstances!



Immediate Windows and Intellisense

A another important thing to consider is the immediate windows. You can run complex code and update variables during the debugging session and there is full
Intellisense support (using CTRL + SPACE to activate it).


Intellitrace

Intellitrace is a very sophisticated debugging tool that allow you to go backward in time and reduce the number of times you have to restart your application for the debugging. This is a feature only available in Visual Studio 2010 Ultimate.


More information on MSDN.

Thread Support

In Visual Studio 2010 there is a specific windows (Thread Windows) that allow you to explore the various threads that are running at the specific point of time and easily switch between them. You can even give a name to a thread in order to be able to later recognise it.




It is also possible to see in which line of code each thread is, using the "Show Thread in Source" option.



Debugger Canvas

This is available only for Visual Studio 2010 Ultimate. I never tried it but I have to say that it looks awesome. It allows to see the context of the debugging session in a much broader way as a set of interconnected code balls. This tools is extremely powerful and support also 
multi-threading applications where each thread is represented by balls of the same colour. Finally, it is possible to export the diagram as an XPS file.




No comments:

Post a Comment

What you think about this post? I really appreciate your constructive feedback (positive and negative) and I am looking forward to start a discussion with you on this topic.