Wednesday, July 10, 2013

Things from Build 2013: $returnvalue

One thing I always found annoying(and it seems I’m not the only one) during debugging is that it was not possible to see return values for functions. The only way was to change your code to first assign the return value to a local variable and then return that value.

Starting from Visual Studio 2013, you no longer need to do this. Now you can examine the return value of a function when you step over or out of a function during your debugging session.

The return value(s) get displayed in the “Autos Windows” (Debug->Windows->Autos) and you can also use the pseudo variable “$ReturnValue” in the Watch and/or Immediate window to fetch the last function’s return value.

If you add a breakpoint to the following code block:

You can see the return values in the autos window

You can also use the last returned value in your immediate window

More info: http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/27/seeing-function-return-values-in-the-debugger-in-visual-studio-2013.aspx

No comments: