I can get information about a parameter by StackTrace using something like this:
catch (Exception ex)
{
var st = new StackTrace(ex);
System.Reflection.ParameterInfo pi = st.GetFrame(0).GetMethod().GetParameters().First();
}
I want know how i get the value of parameter. Example:
If my method in stack trace was like:
void MyMethod(object value)
And the call was like:
MyMethod(10);
I want to get the value 10. How i do that?
To read this stack trace, start at the top with the Exception's type - ArithmeticException and message The denominator must not be zero . This gives an idea of what went wrong, but to discover what code caused the Exception, skip down the stack trace looking for something in the package com.
The printStackTrace() method of Java. lang. Throwable class used to print this Throwable along with other details like class name and line number where the exception occurred means its backtrace. This method prints a stack trace for this Throwable object on the standard error output stream.
A trace of the method calls is called a stack trace. The stack trace listing provides a way to follow the call stack to the line number in the method where the exception occurs. The StackTrace property returns the frames of the call stack that originate at the location where the exception was thrown.
There are two ways. The more powerful is the COM API for .NET Debugging. For example, arguments and local variables of function in the call stack are both accessible from ICorDebugILFrame. But this must be run from a separate process that is attached to your process as the debugger.
For in-process introspection, there's the Profiler API, which also can find information about function arguments. Look at the information about "shadow stacks".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With