473,563 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting parameters to method calls in a stack tract

I am using Visual Studio 2003. When an exception trown (and trapped
by a try statement) in a managed language (say, C#), I'd like to get
the values sent to all the parameters in the stack trace. So, for
example, if the error is something like:

ERROR: The program has performed the following error: Error in
foobar2: Object reference not set to an instance of an object.
at method2(string x, int z)
at method3(ArrayLi st q, float t)

I'd like to figure out what x, z, q, and t were in the catch clause.

I know you can do this in the debugger, but I need to find get this
information when an exception is thrown while the program is running
on a client machine and not in the development environment (remote
debugging is not an option).

Thanks,
Codex
Jul 21 '05 #1
1 1110
Codex <co************ **@yahoo.com> wrote:
I am using Visual Studio 2003. When an exception trown (and trapped
by a try statement) in a managed language (say, C#), I'd like to get
the values sent to all the parameters in the stack trace. So, for
example, if the error is something like:

ERROR: The program has performed the following error: Error in
foobar2: Object reference not set to an instance of an object.
at method2(string x, int z)
at method3(ArrayLi st q, float t)

I'd like to figure out what x, z, q, and t were in the catch clause.


You can't, unless you're running in the debugger and using the
debugging APIs.

When running, the values may no longer be considered "live" - for
instance, the ArrayList may have been garbage collected by the time
your exception is thrown.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

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

Similar topics

5
36387
by: Andy | last post by:
Hi Could someone clarify for me the method parameter passing concept? As I understand it, if you pass a variable without the "ref" syntax then it gets passed as a copy. If you pass a variable with the "ref" syntax then it gets passed as a reference to the object and any changes to
2
1784
by: juchytil | last post by:
Here is a method that calls a static GetInfo() method on the MyObject class. public void MethodName(string param1, int param2) { MyObject.GetInfo(); } Is there any way for the GetInfo() method to find out the name and parameters of the method it was called from?
2
2063
by: Samba | last post by:
Hi, Mine is a very basic doubt ... (1) If we are using a static field/object, then the field/object is shared across all the places in the entire application as it is stored only at one place. (2) If it is an instance-based object, then when each instance gets created, a new memory space gets allocated to every instance.
18
2648
by: IMSHURKKPWII | last post by:
Hi all, I am confused about the methods by which C passes things to other routines. If I have a routine, void rt( , , ...); Then I know that the process to call this function is this: 1. Push values onto the stack, from right to left.
7
3670
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 of those parameters too. I'm trying to write a generic error handler. I wan't to be able to log the values that caused the error, without the...
1
261
by: Codex | last post by:
I am using Visual Studio 2003. When an exception trown (and trapped by a try statement) in a managed language (say, C#), I'd like to get the values sent to all the parameters in the stack trace. So, for example, if the error is something like: ERROR: The program has performed the following error: Error in foobar2: Object reference not set...
18
4327
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I can use dlopen/whatever to convert the function name into a pointer to that function, but actually calling it, with the right number of parameters,...
7
1896
by: Kenneth Brody | last post by:
The recent thread on "query about main()" got me thinking... As I recall, calling a function with the wrong parameters causes undefined behavior. (These all assume that no prototype of foo() is in scope.) For example: ==== fileA.c
0
1987
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ((string)(this.GetPropertyValue("Address1")));
0
7664
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...
0
7583
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...
1
7638
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...
0
7948
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
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...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
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

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.