'How to log an application's entire stacktrace in .NET

I've just started work on an existing .NET application with about 40 active projects. While familiarizing myself with the project, I find myself constantly stepping through the application just to learn the structure and logic flow. It would make this process so much easier if I could let the application run and log every method call and review the log afterwards. I know I can add Debug.WriteLine or Trace.WriteLine statements, but adding those statements to most methods in 40 projects sounds like overkill. Are there any good alternatives to this approach?

CLR Profiler introduced me to the appropriate keyword 'call graph' which led me to a duplicate question, How can I see a visualization of a dynamic call graph for a .NET program?.



Solution 1:[1]

You might check out RedGate ANTS. The purpose of ANTS is performance profiling, but the profiler does give you a very detailed view of what the profiled application is doing, lets you slice and dice the callstack and also lets you jump over to Visual Studio. It's a bit spendy, but well worth it.

Solution 2:[2]

Or you can use something like PostSharp to add the logging automatically for all the methods.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JP Alioto
Solution 2 Cohen