Getting parameters to method calls in a stack tract

  • Thread starter Thread starter Codex
  • Start date Start date
C

Codex

I am using Visual Studio 2003. When an exception trown (and trapped
by a try statement) in a managed language (say, C#), I'd like to get
the values sent to all the parameters in the stack trace. So, for
example, if the error is something like:

ERROR: The program has performed the following error: Error in
foobar2: Object reference not set to an instance of an object.
at method2(string x, int z)
at method3(ArrayList q, float t)

I'd like to figure out what x, z, q, and t were in the catch clause.

I know you can do this in the debugger, but I need to find get this
information when an exception is thrown while the program is running
on a client machine and not in the development environment (remote
debugging is not an option).

Thanks,
Codex
 
Codex said:
I am using Visual Studio 2003. When an exception trown (and trapped
by a try statement) in a managed language (say, C#), I'd like to get
the values sent to all the parameters in the stack trace. So, for
example, if the error is something like:

ERROR: The program has performed the following error: Error in
foobar2: Object reference not set to an instance of an object.
at method2(string x, int z)
at method3(ArrayList q, float t)

I'd like to figure out what x, z, q, and t were in the catch clause.

You can't, unless you're running in the debugger and using the
debugging APIs.

When running, the values may no longer be considered "live" - for
instance, the ArrayList may have been garbage collected by the time
your exception is thrown.
 
Back
Top