[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Tracing Tools for .NET Windows Application

I'm working in .NET Windows Application. In SQL we could use profiler to trace what are the SPs and TSQL commands are executed with respected values. Likewise, is there any tool to trace the .NET Windows application such as which method is being hit and what parameters has been passed to that? If so, please do share with me.

Any tool that make debugging easy in Windows application, please let me know.

Note: I'm using Visual Studio 2008.

Thanks in advance.
0
Easwaran Paramasivam
Asked:
Easwaran Paramasivam
  • 2
2 Solutions
 
hpdvs2Commented:
Yes.  Its called instrumenting, or profiling, and it lets you see what calls are made and how much processing they took within a dll.  You do not see the variables though.

Here is an intro for instrumenting libraries/executables in VS 2008.

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


If you are interested in seeing variable values, the best way is with a debugger attached, so you can pause the application and check anything you want.
0
 
hpdvs2Commented:
Typically an application has so much information going on, that you don't want to turn on Variable detail level recording for an an app in its entirety.  I strongly recommend setting break points or watches in your code.
0
 
Jacques Bourgeois (James Burger)Commented:
Profiling does tell you the methods that were called, the number of times they were called and the time spend in each one, but it does not give you what you are requesting.

What you want is called tracing. There was not built-in mechanism to do that in Visual Studio 2008. One was introduced in 2010. It is called IntelliTrace, but unfortunately, it is available only in the costly Ultimate edition of Visual Studio. I have done a quick search, and there does not seem to be a third party or open source alternative, but a more comprehensive search might turn up something.

For simple tracing, you could use command similar to the following in the important place in your code:

Debug.WriteLine("Entering MethodName - param1=" + param1.ToString() + " - param2=" + param2.ToString());
'Method code
Debug.WriteLine("Exiting MethodName");

The result goes to the Output window by default, but can be redirected to a file (see the Listeners property of the Debug object). You can also use the Trace object in the same way, which would enable for instance to keep Debug for the Output Window and send Trace to a file.

The Debug and Trace objects are activated and deactivated for each configuration of your code through the Advanced Compile Options of the Compile tab of the project's properties window. You could thus have them active in the Debug version of your application, but deactivated for Release so that they not execute when run by the user even if they are in your source code.
0
 
Easwaran ParamasivamAuthor Commented:
Thanks.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now