Re: .NET equilavent to C's backtrace(), or How do I find a calling function?



cmn_ wrote:
My problem is this:

I am programming an application in C#.NET / WinForms. It contains a
MonthCalendar, and whenever the DateChanged event is fired, and *only*
when changing the month, the application goes into an infinite loop.
The event procedure is in a seperate thread, although I'd rather not
post it here until asked (there's a *lot* of code there).

On top of this, the event procedure is called from several places in
the code. How would I find which function called the event procedure
in code? If there is no way to find the caller of the function, is
there something like the Backtrace() function in the Standard C
Library? (btw, yes I am a C rather than C# coder...)

FWIW, there's no such function in the standard C library as backtrace -
that's strictly a GNU libc extension.

As Ben already replied, you can get the precise stack trace from
Environment.StackTrace.

-cd


.



Relevant Pages


Loading