| |
microsoft.public.dotnet.framework.clr |
news:OAxYBgLiGHA.1276@TK2MSFTNGP03.phx.gbl... If you are trying to add additional information to an exception stack trace, Only methods still on the call stack have valid locals. If you are in the Exception constructor trying to capture the information, Also remember that in the case of recursion, there may be multiple stack If you're wanting an automated way to enumerate local variables in the The runtime provides minidump functionality, I suggest you use that in lieu
> values from the objects returned back by .LocalVariables. How is this
> done? LocalVariables only appears to give us the types of the method vars.
> -LZ
only well-defined at very specific times.
please realize that by the time control reaches a handler, the call stack is
already unwound, and stack space may have been overwritten by, for example,
finally blocks that have already executed.
then it is theoretically possible to capture the details, however consider
that the MSIL is converted to machine code, so any solution is going to be
architecture and runtime specific. For example, mono might store local
variables in a different order than ms.net. There's a WinAPI routine
StackWalk that might be of some use... but not much. You basically require
the debugging API distributed with the JIT compiler, since only it can
determine where the variables are stored.
frames corresponding to a single MethodBody and LocalVariableInfo.
current method, please consider that your code will never be reuseable
because the process of encapsulating it changes the scope of variable
capture.
of any attempt to capture state information on your own.