Get calling function in a function?

J

Joerg Battermann

Hello there,

I have a quick question:

When calling a function B from within a function A, is it possible get
information about the calling function A (e.g. name, values passed over
etc) from within the function B?

The reason why I am asking, is, for example when handling exceptions or
logging errors so I know what exactly happened.


Thanks and all the best,
-joerg
 
P

Phill W.

Joerg said:
When calling a function B from within a function A, is it possible get
information about the calling function A (e.g. name, values passed over
etc) from within the function B?

"Name"? - Yes.
"Values" passed over - No.
The reason why I am asking, is, for example when handling exceptions or
logging errors so I know what exactly happened.

Like me, you've discovered that "Good" code doesn't just break, it get's
broken by "Bad" data - and that's conspicuously /missing/ from .Net's
built-in StackTrace.

I'd suggest building your own module to augment the built in StackTrace,
marking the entry and exit points of each [major] method (/with/
arguments and return values), but it would have to be a Global thing
within each application - you don't want to be passing it around into
practically every function - don't know if that would be an issue for you.

HTH,
Phill W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top