Hi, how can I trace code execution of my C# application? Are there any tools available. Please Help. I have an issue in my production site.
Thanks in Advance
Hi, how can I trace code execution of my C# application? Are there any tools available. Please Help. I have an issue in my production site.
Thanks in Advance
Can you, in your code, write the debug information ( e.g, "now at method 1") to a log file?
There is a built in tool in visual studio called a debugger.
You set a breakpoint in your code and step through.
The .NET framework also provides tracing classes in the System.Diagnostics namespace.
For a running application that has no code support for tracing, you may be able to use a profiler (such as the redgate ANTZ profiler or the JetBrains dotTrace), but this will impact performance.
If you have a memory dump (either from a crash or an manually induced one), you can use windbg to analyse the dump. This will include trace information.
In Visual Studio 2005+ press F11 instead of F5 to run the application.
Or you can insert a breakpoint (clicking to the left of the line where you want to break so that VS shows a red dot).
Visual studio has great debugging tool however if that too terned out to be not sufficient then you can start with static code analysis tools which are helpful to analyze the code branches.
To trace production Issues the best option is ETW tracing. Especially in ASP.NET there are built-in providers which can help identify the Perf Issues.
And if you are using Window2008 then the ETW traces can give call-stacks. There are ETW tracing from IIS, FileSystem , Registry , Threading and everything possible. Here is an MSDN article on this and to get Managed call-stacks I have few posts