Take the following function:
DataTable go() {
return someTableAdapter.getSomeData();
}
When I set a breakpoint in this function, is there a possibility to inspect the returned value? go()
is directly coupled to a datagrid in an .aspx
page.
The only way to inspect the returned datatable is to use a temporary variable. However, that's a bit inconvenient. Isn't there another way?
The accepted answer doesn't work properly with Visual Studio 2015, but by placing a break point on the last line of the method and pressing F10, it will put all expressions of the return value into the locals window.
This can be done in Visual Studio 2013 with CLR 4.5.1 according to the customer feedback site. It was not available in previous versions for C#.
(Visual Studio 2008 and earlier supported it for VB.NET. It has always been available to C/C++ developers.)
Old trick from the pre .NET days: Open the Registers window and look at the value of the EAX register. This contains the return value of the last function called.
Yes, there is a very nice way. One significant drawback is that you'd have to wait for 5, maybe 6 years. Since I see that you posted in November 2008, I suggest that you waaaaaa...
...aaaait. And voilà! Just for you, MS has released the latest Visual Studio 2013 where it's a default feature accessible from the menus while running in debug mode (menu Debug → Windows → Autos).
I think you can determine this by looking at the RAX register in the Registers window (Debug / Windows / Registers). After stepping out (SHIFT + F11) of the function, check the RAX register. I don't know for a fact, but once upon a moon you could check a register (pre .NET days) and see the return value there. It might even be a combination of RAX and RBX, etc.
If you go to menu Tools → Options, IntelliTrace, and change the setting to collect events and call information.
You can go back to the previous call event (Ctrl + Shift + F11) and see the temporary value returned from the method call in the autos window as a child of the method name.
This isn't showing you the return value for the method you are in. It just shows you the return value of the last method called in the current method.
So, it's fine for
as it shows you the return value for
someTableAdapter.getSomeData()
.But not for: