By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

HELP: how to get values of function arguments at run time (.NET reflection) ?

P: n/a
Hi all
I am using .NET reflection to examine a stack trace, using the StackTrace,
StackFrame, MethodInfo, ParameterInfo and FieldInfo classes.

I can easily discover all methods in the call chain and discover their
parameter names and types.

What I would like to do is also know the values that were passed to the
method parameters for the current instance. I would think this should be
possible, because that info must be somewhere in the stack trace, right ?

I felt I was getting somewhere by using the FieldInfo.GetValue() method, but
I just can't seem to get it to work. It looks like the GetValue method only
gets values for class properties and such, but not function parameters.

Does anyone have any tips ?

Thanx !
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Marco" <Ma***@bla.com> schrieb

I am using .NET reflection to examine a stack trace, using the
StackTrace, StackFrame, MethodInfo, ParameterInfo and FieldInfo
classes.

I can easily discover all methods in the call chain and discover
their parameter names and types.

What I would like to do is also know the values that were passed to
the method parameters for the current instance. I would think this
should be possible, because that info must be somewhere in the stack
trace, right ?

I felt I was getting somewhere by using the FieldInfo.GetValue()
method, but I just can't seem to get it to work. It looks like the
GetValue method only gets values for class properties and such, but
not function parameters.

Does anyone have any tips ?


(AFAIK) this is only possible when using a debugger.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.