Call Stack 
Author Message
 Call Stack

Hi guys

Is there any way to access the call stack information inside a C# app?
Initially I want to call a method on a custom trace object which records
that the method has been called, and when the method has completed.

I don't want to have to do something like

public void ProcessData()
{
    myCustomTrace.Log("ProcessData() called...");
    ...
    myCustomTrace.Log("ProcessData() completed");

Quote:
}

I would rather just do:

public void ProcessData()
{
    myCustomerTrace.ProcedureCalled();
...
    myCustomerTrace.ProcedureCompleted();

Quote:
}

and have it automatically work out where I was.

Many thanks in advance for any help
Adam



Sun, 17 Oct 2004 17:40:42 GMT  
 Call Stack
Actually guys, I've just discovered System.Environment.StackTrace

Couldn't see for looking...


Quote:
> Hi guys

> Is there any way to access the call stack information inside a C# app?
> Initially I want to call a method on a custom trace object which records
> that the method has been called, and when the method has completed.

> I don't want to have to do something like

> public void ProcessData()
> {
>     myCustomTrace.Log("ProcessData() called...");
>     ...
>     myCustomTrace.Log("ProcessData() completed");
> }

> I would rather just do:

> public void ProcessData()
> {
>     myCustomerTrace.ProcedureCalled();
> ...
>     myCustomerTrace.ProcedureCompleted();
> }

> and have it automatically work out where I was.

> Many thanks in advance for any help
> Adam



Sun, 17 Oct 2004 17:48:45 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Showing Call Stack and Determine which object is not valid LARGE CHUNK OF CODE

2. Call Stack not showing up?

3. function pointers, casting, call stack overwriting

4. help with loading call stack

5. function pointers, casting, call stack overwriting

6. programatically accessing call stack information

7. How to portably walk the call stack?

8. IIS Automation object: how do I get a call stack when it crashes

9. Size of call stack in debugger

10. Help.... Call stack gone, Context garbage

11. No Call Stack

12. Call stack/context window suddenly broken

 

 
Powered by phpBB® Forum Software