Getting the parameters passed to a function and log them

  • Thread starter Thread starter Julia
  • Start date Start date
J

Julia

Hi,

I have been asked this before but I think that I didn't explain myself well

I am using exception and logging and I would like to log the parameters
which was passed to the function
whenever an exception was occurred,again,I want to emphasize that I am the
owner of the code.

I can see that idlasm can view the content of an assembly so I wonder why my
logging module cannot
use reflection to get the function signature and than poll the passed
parameters from the stack

Another option I can think of is to create an exception class which hold an
array of parameters and values.
a function which throw an exception can fill this array
so I can logged it

BTW:It can be done with _penter in C++
(http://www.johnpanzer.com/aci_cuj/)

Thanks in advance.
 
Hi,

You can get the signature of the method using StackFrame.GetMethod, but as
far as getting the actual values of the parameters I don't think it's
possible, I believe it has to do with the complexity of the reference types.

IIRC this was asked like two weeks ago, so you may look in google.


Cheers,
 
Back
Top