S
Steve
Hello --
I've been struggling with this problem for over a day now. I'd like to
know (without passing parameters) which class, and preferably, which
method of that class has called my function.
I can get the calling assembly rather easily, but let's say within
Assembly X I have
class A
class B
class C
I'd like to know that in Assembly X, Class C, Method callFunction() has
invoked my function.
So, use the StackTrace and StackFrame classes, right? A bit of a
problem when it comes to the release build. I also am not fond of
deploying .pdb files out to production.
The StackTrace and Frame work perfectly in debug mode.. however, in the
release build, either the compiler optimizes or something, since it
tends to "skip" my calling function, and goes to the one before it. Ex
(Desired trace ran in debug mode)
WhoIsKnocking()
callFunction()
button1_onclick()
in release builds, I get
WhoIsKnocking()
button1_onclick()
I find it hard to believe that no information is given about the stack
in a release build. Or reflection does not allow to find out the
calling object. I'm using .Net 2.0.
Am I missing something basic, or is there another class/package out
there that I haven't looked at yet?
I've been struggling with this problem for over a day now. I'd like to
know (without passing parameters) which class, and preferably, which
method of that class has called my function.
I can get the calling assembly rather easily, but let's say within
Assembly X I have
class A
class B
class C
I'd like to know that in Assembly X, Class C, Method callFunction() has
invoked my function.
So, use the StackTrace and StackFrame classes, right? A bit of a
problem when it comes to the release build. I also am not fond of
deploying .pdb files out to production.
The StackTrace and Frame work perfectly in debug mode.. however, in the
release build, either the compiler optimizes or something, since it
tends to "skip" my calling function, and goes to the one before it. Ex
(Desired trace ran in debug mode)
WhoIsKnocking()
callFunction()
button1_onclick()
in release builds, I get
WhoIsKnocking()
button1_onclick()
I find it hard to believe that no information is given about the stack
in a release build. Or reflection does not allow to find out the
calling object. I'm using .Net 2.0.
Am I missing something basic, or is there another class/package out
there that I haven't looked at yet?