harriyott.com

Debugging return values in Visual Studio

Let us suppose that we're debugging an application in Visual Studio .NET 2005. Let us also suppose that we have a method similar to the following:

// Let us also suppose that this is good code.
public int GetFalseStapleWotsit()
{
return staple.GetWotsit(false);
}

Let us suppose that we had a breakpoint on the closing curly brace, and that we had reached said breakpoint during normal debugging. Let us assume also that we have no code or .pdb for the assembly containing the staple object's class definition, and thus we cannot step into it.

How would we know what value staple.GetWotsit(false) had returned? There are no variables to show up in the autos, locals or watch windows, and there is nothing to hover over in the code. The only solution I have come up with so far is to put staple.GetWotsit(false) into the immediate window (Ctrl+D+I) and press enter. This calls the function again, and puts the returned value on the next line. Surely this can't be the best way. I'll just wait for a big-brain to leave me a comment to tell me exactly where I'm going wrong.

[Tags: ]
23 May 2006