0

exact duplicate:
How can I add a Trace() to every method call in C#?


Hi, I like to do tracing in my c# code. I don't like to add statements in each method to do it. Is there any way to use a method to do trace when rest of the methods in the application getting invoked at runtime.

Thanks, P.Gopalakrishnan.

Community
  • 1
  • 1
gopal
  • 3,681
  • 5
  • 24
  • 25
  • See this question: http://stackoverflow.com/questions/559148/how-can-i-add-a-trace-to-every-method-call-in-c – Andy White May 07 '09 at 05:03

2 Answers2

0

If you use VS 2005 (and probably 2008, and maybe 2003), you can just add a tracepoint, similarly to the way you add breakpoints. You can then define what output you want when that method/code line is hit. It will only output those traces when run inside VS, but it might be a good way to start.

Noam Gal
  • 3,315
  • 3
  • 36
  • 53
0

If you have it available to you, the Profiler in Visual Studio will trace your method calls and provide a call tree etc.

Steven
  • 3,878
  • 3
  • 21
  • 21