Function return values inspection in Visual Studio 2013

Visual Studio 2013 introduced a great feature  that helps you to inspect all the functions / nested functions returns values during the current debugging session.  This is really useful when the returned values are  not stored in a local variables and you want to check them. You can actually view then by giving the specific values in Watch Window. But you need to do them manually . With the help of new features of VS 2013 debugger, you can take help of Autos windows to view the functions return values together.

Autos variables are automatically detected by the VS debugger during the debugging. Visual Studio determines which objects or variables are important for the current code statement and based on that, it lists down the “Autos” variable.

In Visual Studio 2013, consider you have the following code block

class Program
{
static void Main(string[] args)
{
string fullName = string.Format("{0} {1} {2}", GetFirstName(), GetMiddleName(), GetLastName());

}

private static string GetFirstName()
{
return "Daily";
}

private static string GetMiddleName()
{
return ".NET";
}

private static string GetLastName()
{
return "Tips";
}

}

 

If you open the “Autos” windows from “Debug > Windows > Autos” you will find all the list of calling function as well as the return values ( Refer the image below). Where you can find the return values for the individual function calls.

VS2013_Function_ReturnValue

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

One Comment to “Function return values inspection in Visual Studio 2013”

Comments are closed.