473,789 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtain parameter values from method

ME
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
Sep 21 '07 #1
2 3340
"ME" <tr*********@co mcast.netREMOVE THISwrote in message
news:o7******** *************** *******@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

Sep 21 '07 #2
ME
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/Window...60c.aspx#q978q

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.saunder s at trizetto.comwro te in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
"ME" <tr*********@co mcast.netREMOVE THISwrote in message
news:o7******** *************** *******@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

Sep 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3771
by: Marcin | last post by:
Hello! Is there any method to detect parameters values passed to called method? For example: public Guid ApplicationLogin(string userName, string password, int dbId)
5
18692
by: Kevin Myers | last post by:
How can one obtain obtain the height of a MS Access 2K form? There is a width property, but I don't see a corresponding height property. I need to obtain the height of the form so that I can dynamically resize an object on the form in the form's Form_Resize method when a user resizes the form, both horizontally and vertically. Thanks, s/KAM
7
4246
by: Abhishek Srivastava | last post by:
Hello All, I am facing a simple problem. I have a method which accepts two parameters. Both are of type DateTime. However when calling this method there are times when the caller does not have a value of DateTime with it. I tried calling the method with null params but that didn't work because DateTime is a struct. but I don't want to assign any values to it... because eventally the
7
5328
by: A.M | last post by:
Hi, Do we have default method parameter in C#? Something like this void method1(int i = 12) { .... }
15
1895
by: SFX | last post by:
If I have a session ID (string) can I somehow obtain the session object associated to that ID (it exist of course) ? I know this sounds wicked but I have a situation in which I have to make a request from the client (IE) but for security reasons I can not access the headers of the current request, so I can not make my new request contain the same session ID cookie. So I was thinking that if I pass the session ID as a parameter which I...
2
6855
by: MrDotNet | last post by:
Hi I want pass NameValueCollection as parameter in webmethod. I try it but that give me error. Here is Error. You must implement the Add(System.String) method on System.Collections.Specialized.NameValueCollection because it inherits from ICollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in...
2
2861
by: Steve Amey | last post by:
Hi all I would like to get the values of Parameters passed to a method from a centralized exception handling routine. At the moment, the exception is passed to the handler, and I can get the stack and find out which methods are in it and what parameters those methods take, but I would really like to know the values of the parameters, something like below: HandleException(Exception Ex = MyCustomException) FillFromDataBase(Integer...
2
2419
by: chris | last post by:
I am sure I am overlooking something simple, but here goes. In the global.asax file I have some code in the Application_Error method that reads information out of the current exception and emails it to me. I want to see what the parameter values are for the method throwing the exception. I am using reflection to get the parameter metadata, but this does not do me much good. Exception ex = Server.GetLastError().GetBaseException(); ...
2
2494
by: ME | last post by:
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,
2
1447
by: mm3178 | last post by:
Hello Mates, My case is slightly complicated....please help me In order to obtain real time current balance of an account, I have built a c# windows service that invokes a c# web service recursively after every 2 secs. The web service accepts that accout number as an input parameter, invokes a stored procedure and returns the current balance of the input account no. My problem is with the performance. Invoking a webservice every 2...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3703
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.