The referred duplicate is a) not VS 2015 specific, b) there is an explicit comment there for the accepted answer:
unfortunately, it doesn't appear to be in VS2015 (devenv v14)
so I am looking for how to do this in VS 2015?
--- Original question was: ----
While debugging in VS 2015 many times I would like to know the actual value what a method returns. (like return <expression>;
)
In scenarios often I can not figure out better, than (stop), modify the source code and write
var result = <expression>;
return result; // and place a breakpoint here, and "watch" the result variable.
Scenarios like:
- The
<expression>
is complex like LINQ with many embedded functions, and potentially evaluating it may have side effects, or simply the iterator can not be iterated multiple times - ...or... The debugger hangs when trying to evaluate
<expression>
interactively in watch window - At caller side the context is not as simple like x = y.MyMethod(), so I can simply see the return value there (instead evaluating of MyMethod return value)
I just wondering is there a built in way what I am missing, and placing a breakpoint (see below) and somehow know the actual (already evaluated) real return value?
//...
return <expression>;
} // place a beakpoint here and see what is the actual eveluated return value
// Maybe I am wrong, but I think it must be an point in time when the actual
// return value is already evaluated runtime so it is not an extreme idea to
//allow to "watch" it for the developer.