Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return value in Visual Studio's Autos window

When I used to develop in C++, I remember that Visual Studio had an entry in its Autos window whenever returning from a function call. This entry would tell me what value was returned from that function.

One might argue that if a function returns a value, then you should set a variable to that value, i.e.

int i = GetRandomInt();

But as a contrived example, suppose I wanted to do this:

CycleTushKicker( GetRandomInt());

Instead of stepping into CycleTushKicker to figure out how many lickings my kid gets, I'd just like to know the value as soon as I exit GetRandomInt.

Is there a way to get this when using C#?

EDIT -- followed @Michael Goldshetyn's advice and filed a feature suggestion on Microsoft Connect. You can place your votes here: https://connect.microsoft.com/VisualStudio/feedback/details/636130/display-return-value-from-function-in-autos-window-for-c

like image 810
Dave Avatar asked Jan 13 '11 15:01

Dave


People also ask

How do I display a variable value in immediate window?

To view the variable's value, simply type its name into the immediate window and press Enter. The value, "Hello world" will be displayed beneath the typed line, as in the image above. To access properties of a variable or value, use the member access operator (.) as you would within source code.

How do I get the value of a variable in Visual Studio code?

Hover over a variable to see its value. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.

How do I go back while debugging in Visual Studio code?

These icons navigate the events in the Events Tab. So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step. This will automatically put Visual Studio in Historical debugging mode, at the line of code you've stepped back to.


1 Answers

There is no way to see the return value of a function in the Autos pane of VS2010 when using C#. If you want to be able to see this value, you will need to assign it to a temporary variable, and then you will see this variable's value (at least in debug builds).

Update

VS2013 now offers this functionality

like image 92
Michael Goldshteyn Avatar answered Oct 07 '22 00:10

Michael Goldshteyn