Function return value in debugger
I want to able to see function return value in managed debugger just like unmanaged debuger (it has this feature from Visual Studio 6.0!).
Function return values are now available when debugging C# and VB applications with Visual Studio 2013 and CLR 4.5.1.
You can download the Preview here:
Currently, this feature doesn't work as well in the Watch and Immediate Windows as it does in the Auto Window.
Can this be worked on?
Konrad Sikorski commented
Rail Sabirov commented
Thanks a lot!
Actually, a simple compromise which can potentially satisfy a large percentage of users is to make the "return" keyword mouse-overable like any other local variable in the function, assuming the line has already been executed.
Currently, you can always step to the closing brace after any given return statement, so essentially you'd step over the return statement to the following closing brace, and at that point you'd be able to mouse over the "return" keyword to see what was about to be returned.
If implemented, this would be so handy and useful!!! Please, please make it true.
For those out there who have experience debugging native C++ or VB6 code, you may have used a feature where function return values are provided for you in the Autos window. Unfortunately, this functionality does not exist for managed code. While you can work around this issue by assigning the return values to a local variable, this is not as convenient because it requires modifying your code.
In managed code, it’s a lot trickier to determine what the return value of a function you’ve stepped over. We realized that we couldn’t do the right thing consistently here and so we removed the feature rather than give you incorrect results in the debugger. However, we want to bring this back for you and our CLR and Debugger teams are looking at a number potential solutions to this problem. Unfortunately this is will not be part of Visual Studio 11.
Omer Raviv commented
I implemented this feature as part of a commercial extension to Visual Studio called "BugAid", currently in beta.
Not only does it support seeing the return value of the method before stepping out of it, but also seeing the return value of the method calls you stepped over. Please see my blog post on the subject: http://www.bugaidsoftware.com/2011/11/tips-for-using-statement-visualization/ and try it out for yourself!
DeonHe - MSFT commented
Thank you all for voting on this idea. I have moved it to the team that can better address this issue.
Timo Boehme commented
Just open the "Auto" Tab in window menu and you will get more than the VB6 informations.
Alex Blokha commented
I vote 4 it.
Rail Sabirov commented
Unfortunately vs2010 still has no support return value display in Auto window in C# debugger.
You already can in vs2010. Auto window lists return value.
Jared blogged about this, kind of. I don't like that he 'throws the baby out with the bathwater' by including the case of stepped-over functions (I'd rather have an option that makes me set a breakpoint at the end of a function than no option at all!), but it's on topic for this suggestion at least. :)