Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Tracing Tools for .NET Windows Application

Posted on 2012-12-27
4
259 Views
Last Modified: 2013-01-03
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
Comment
Question by:Easwaran Paramasivam
  • 2
4 Comments
 
LVL 8

Expert Comment

by:hpdvs2
ID: 38723569
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
 
LVL 8

Accepted Solution

by:
hpdvs2 earned 150 total points
ID: 38723572
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
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 350 total points
ID: 38724402
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
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 38740670
Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question