I would like to write a reusable function I can call within any method to log a snapshot of all the local variables. For example:
void somemethod()
It is possible by using external debugger for managed code. See "managed debugger sample" for how it is done: http://blogs.msdn.com/b/jmstall/archive/2004/09/30/236281.aspx (includes link to the sample and more information)