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.
Pingback: .NET Tips and Tricks from Daily .NET Tips – July and August 2013 Links | Abhijit's World of .NET