[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Obtain parameter values from method

ME

9/21/2007 2:36:00 AM

How would one obtain the parameter VALUES of a method that has already run?
I can find the method using the StackTrace and StackFrame classes but once I
find the method I would like to obtain the value of one of the parameters
that were passed to the method. Is this possible? Even if I have to use
PInvoke to do so?

I can currently find the parameter TYPEs using reflection but I can not
figure out to obtain the values.

Thanks,

Matt


2 Answers

John Saunders [MVP]

9/21/2007 3:14:00 PM

0

"ME" <trash.trash@comcast.netREMOVETHIS> wrote in message
news:o72dna_nouhqsG7bnZ2dnUVZ_oCvnZ2d@comcast.com...
> How would one obtain the parameter VALUES of a method that has already
> run? I can find the method using the StackTrace and StackFrame classes but
> once I find the method I would like to obtain the value of one of the
> parameters that were passed to the method. Is this possible? Even if I
> have to use PInvoke to do so?
>
> I can currently find the parameter TYPEs using reflection but I can not
> figure out to obtain the values.

What is the context here? Where is this method you're trying to get values
from?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

ME

9/22/2007 3:26:00 AM

0

The method is within the call stack of the current running process. It will
be in a different assembly (usually System.dll) I find it by itterating
through the call stack (using the StackTrace class and the StackFrame
class). Once I find the method the StackFrame class allows me to obtain a
MethodBase object that includes the method name various other properties
that describe the method, including the parameter types and names.

Here is an example of finding the Method via the above approach:
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c60c....

Unfortunately though this does not include the actual VALUES of the
parameters that where passed into the method when it was called. To get an
idea of what I am trying to accomplish, simply view the Call Stack in Visual
Studio. There you will see what methods were called in your code and what
parameters wered passed to them (including the values). Hence, I believe
this is possible, I just do not know where to start to figure out how to do
it. For example, what are the rules of obtaining these values? Must the
application be in debug mode? Is there a way to use the windows API to
obtain the values?

Thanks,

Matt


"John Saunders [MVP]" <john.saunders at trizetto.com> wrote in message
news:%23aQ28HG$HHA.4828@TK2MSFTNGP04.phx.gbl...
> "ME" <trash.trash@comcast.netREMOVETHIS> wrote in message
> news:o72dna_nouhqsG7bnZ2dnUVZ_oCvnZ2d@comcast.com...
>> How would one obtain the parameter VALUES of a method that has already
>> run? I can find the method using the StackTrace and StackFrame classes
>> but once I find the method I would like to obtain the value of one of the
>> parameters that were passed to the method. Is this possible? Even if I
>> have to use PInvoke to do so?
>>
>> I can currently find the parameter TYPEs using reflection but I can not
>> figure out to obtain the values.
>
> What is the context here? Where is this method you're trying to get values
> from?
> --
> --------------------------------------------------------------------------------
> John Saunders | MVP - Windows Server System - Connected System Developer
>