I have a line of code like this
return foo(barIn);
If I place a breakpoint on the line can I inspect the returned value of foo(barIn) without stepping into foo? I can rewrite the code to
var result = foo(barIn);
return result;
but I’d like the convenience of not rewriting and not stepping away from the current code.
========== EDIT ==========
The four initial answers are interesting (thanks) but they do not actually answer my question. Let me try to be clearer.
In this method
public string functionA()
{
return functionB();
}
is there a way in Visual Studio 2012 to place a break point on the line “return functionB();” and inspect the return value of functionB without stepping into functionB, re-running functionB, or rewriting functionA?
No, you cannot meet this exact behaviour. See Can I find out the return value before returning while debugging in Visual Studio. The closest you can get is:
If
foois idempotent (i.e. it does not have any side-effects), then you can add a watch tofoo(barIn).If it does have side-effects, then put your breakpoint on the
return, and then step-out (Shift+F11 by default) of the function and inspect the variable that the result of the function is assigned to.