7

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

Is there an easy way to log all called functions (in order of execution, also passed argument values to these f-ns) in a C# application while it is being executed in debug mode in VS2010? For example, I press some button on my form, some complex code is invoked. Now I want to see what functions in what classes with what arguments.

Note that adding debug/trace info to functions is not an option!

Community
  • 1
  • 1
mmierins
  • 3,674
  • 4
  • 21
  • 25

2 Answers2

4

IntelliTrace in VS2010

http://msdn.microsoft.com/en-us/library/dd264915.aspx

http://msdn.microsoft.com/en-us/magazine/ee336126.aspx

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
0

You need an AOP logger, like Log4Net. Instead of putting in Debug/Trace writes, you decorate the methods you want logged with attributes; the attributes will fire events when the method is entered and exited, which the logger will respond to, writing the text you specify for those events to the log file. I believe you can also specify global rules for logging so you don't even have to decorate each method.

KeithS
  • 70,210
  • 21
  • 112
  • 164
  • One of the AOP logger Keith referring to is PostSharp. http://www.sharpcrafters.com/ – Nair Jun 13 '11 at 17:42