Debugging like a Pro in Visual Studio

,

Debugging like a Pro in Visual Studio

Viewing method return values in the Locals/Autos windows in Visual Studio

Visual Studio is packed with tons of great debugging tools. There are so many tools that it’s often hard to keep track of them all. Simply knowing about a tool can make a significant improvement to your productivity. In this post, we’ll look at how you can examine the return values from methods in the Locals and Autos windows.

 

Let’s take a look at a very simple program as an example. It prints out the even numbers from the fibonacci sequence until it overflows its integer.

 

 

In the Locals (CTRL+ALT+V, L or Debug >> Windows >> Locals) and Auto (CTRL+ALT+V, A or Debug >> Windows >> Autos) windows, you will see the returned values from each of the function calls when you step over statements while debugging. You can then inspect these values individually just like any other variable.

 

Debugging method return values in locals window

 

It is important to note, that you will only see these when stepping through code. If you run to a particular location,you will not see the individual method return values.

Share this story