By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

Get calling function in a function?

P: n/a
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

May 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Joerg Battermann wrote:
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.
May 19 '06 #2

P: n/a
Phil,

thanks for the reply. I'll give the later one a try (because the value
often is the critical part in my case). For others who need reference,
here's some information concerning .net's stacktrace:

http://www.codeproject.com/dotnet/MethodName.asp
http://www.codeproject.com/vb/net/vbnettrace.asp
http://msmvps.com/blogs/manoj/archiv...3/25/4191.aspx

All the best,
-Joerg

May 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.