Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check the about-to-be-returned value in the debugger [duplicate]

Possible Duplicate:
Can I find out the return value before returning while debugging in Visual Studio
VS get returned value in C# code?

In Visual Studio 2010, is there a way to check the value that a method is about to return? I often find myself changing code like:

return myComplexOp(someOtherComplexOp(foo));

to

var ret = myComplexOp(someOtherComplexOp(foo));
return ret;

just to make it easier to debug? Is there an easier way?

like image 782
JoelFan Avatar asked Oct 03 '11 19:10

JoelFan


1 Answers

With C++ code I am stepping out of the function (Shift + F11) and open Autos window (Debug, Windows, Autos). At this point it shows recently returned value like this:

Debug, Windows, Autos

It's not the most convenient thing, but it's still something. At least you can see the returned value without altering code as mentioned in original post.

like image 160
Roman R. Avatar answered Nov 09 '22 01:11

Roman R.