David Stone's Blog

I'm open to suggestions for a subtitle here! (Really!)

The Immediate Window

But for me, this begs a different question. In VB6 IDE you could actually do this from the immediate window. Start up a module, instantiate a class and test one of it's methods. Or even experiment with VB functions that you had just discovered. Although nUnit, etc are great, there are times that I would love to still be able to do this in the VS.NET IDE but you can't because you need the CLR running. There must be a tool the enables this. Mostly I would like it to test functions and methods from the framework as I discover them.

[Julia Lerman's Blog]

I was beginning to think I was the only one who wanted an app like this. I totally agree with Julia here, there's got to be some sort of tool. This was the thing I found most lacking from the Immediate window when I came from VB6 and moved to C#. I even tried it out in the VB.NET side of the IDE and much to my chagrin, it wasn't there either. Sometimes firing up VS.NET to see what the output from a method would be seems like overkill...and yet I can't see any better way of doing it...

Comments

leppie said:

In managed code, the debugger can evaluate an expression as follows:
• Parse the expression
• Call the Debugging APIs to
• Access values of variables in the expression.
• Invoke functions in the expression.
Alternatively, the debugger can do the following:
• Wrap the expression in a global function and compile the function.
• Call the Debugging API (Edit & Continue) to add the global function.
• Call the Debugging API to evaluate the function.
The following is a step-by-step description of how a debugger evaluates an expression. In this scenario, the expression is A + Foo() where A is assumed to be in a register and the code being debugged is native managed.
• The debugger obtains the value of A. The debugger calls GetLocalRegisterValue on the ICorDebugNativeFrame object for the stack frame in which the expression is to be evaluated.
• The debugger creates an evaluation object. The debugger calls CreateEval on the ICorDebugThread object for the thread in which the expression is to be evaluated.
• The debugger computes the value of Foo(). The debugger calls CallFunction on the ICorDebugEval object.
• The debugger evaluates the expression. The debugger applies constant folding to the expression using the values obtained in the previous two steps.
# July 31, 2003 1:56 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)