473,769 Members | 3,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting the parameters passed to a function and log them


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.


Nov 16 '05 #1
1 3409
Hi,

You can get the signature of the method using StackFrame.GetM ethod, 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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Julia" <co********@012 .net.il> wrote in message
news:es******** *****@TK2MSFTNG P09.phx.gbl...

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.

Nov 16 '05 #2

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

Similar topics

1
2612
by: John Miles | last post by:
Hi -- This is a bit of an implementation-specific problem, but I'd like to post it here to see if there's a general answer within the auspices of the language. I'm developing a high(er)-level scripting language designed explicitly to complement C++. One of the language's features is the ability to pass "out" parameters to an MSVC __cdecl function by reference. After the C++ function returns, but before popping the parameters from the
7
11282
by: Aaron Gray | last post by:
I put together the following code to get the href's parameters :- function GetParameters() { var arg = new Object(); var href = document.location.href; if ( href.indexOf( "?") != -1) { var params = href.split( "?");
3
1934
by: TC | last post by:
Hey All, I have some classes that I recently built for a website which uses the HttpWebRequest & HttpWebResponse objects from the System.Net namespace. Basically, the classes rap submitted data up, connect to external websites on external servers and post / remove the data from these other sites. It works fine locally but when uploaded to the BCentral production server, the outgoing requests get shutdown.
18
2998
by: nar0122 | last post by:
//Nicholas Riseden //CSCI 3300 //Assignment 4 Version 2 #include "tree.h" #include "pqueue.h" #include <string> #include <fstream> #include <iostream> #include <stdio.h>
0
10208
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
10036
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
9987
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
9855
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
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
6662
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();...
0
5294
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
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.