473,395 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get parameter values from StackTrace, MethodBase?

Hi all:
I have a logging class, which is used to log errors automatically. With
StackFrame.GetMethod().GetParameters() function, I am able to read all
parameter information except the real paramter value from ParameterInfo
class.
is there a way I can read real parameter values?
Thanks!!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
Nov 15 '05 #1
1 14442
Hardy,

As you shouldn't, as the ParameterInfo class represents the parameter,
not the call itself. It is the call that contains the values of the
parameter. It's kind of like saying why doesn't the MethodInfo class tell
you what the return value is (not the type, but the value)?

It would be nice if there was a GetParameterValues method on the
StackFrame instance, which would take a ParameterInfo instance and then
return the value in that parameter.

If you want to get this information, you have to pass the values to your
logging object somehow.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Hardy Wang" <ha********@marketrend.com> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
Hi all:
I have a logging class, which is used to log errors automatically. With StackFrame.GetMethod().GetParameters() function, I am able to read all
parameter information except the real paramter value from ParameterInfo
class.
is there a way I can read real parameter values?
Thanks!!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy

Nov 15 '05 #2

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

Similar topics

3
by: Angelos Karantzalis | last post by:
Hi y'all .. I hope this is an interesting one ... Within an executing method, I can call MethodBase.GetCurrentMethod() and retrieve info about the method that's currently running, including...
7
by: Brad Quinn | last post by:
Is there a way to get the values of the paramaters to a method programatically? I know that I can use reflection to find out the parameter names and types, etc., but I want to know the values...
3
by: Kurt Biesemans | last post by:
Hello, I have a line code : StackTrace stackTrace = new StackTrace(false); When I run the project in debug, the application keeps hanging on this line. My Environment: Windows 2003 Server...
2
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...
2
by: Phill W. | last post by:
For some time, I've been adding "trace level" logging to my code using Imports System.Reflection Private Function XYZ( a1 as A, b1 as B, c1 as C, ... TRACE.Log(...
2
by: news.microsoft.com | last post by:
Hi all. If I wanted to write something so that, when an exception was thrown, and the stack unwound, the stack trace was captured with the values of the parameters (instead of just the parameter...
2
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...
12
by: Zytan | last post by:
I use System.Diagnostics.StackTrace to get the stack trace of the current function, to print out the function's name to the log, and sometimes it shows that a function that doesn't even write to...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.