PC Review


Reply
Thread Tools Rate Thread

Debugging hanging C# program

 
 
zfeld
Guest
Posts: n/a
 
      6th Jan 2005
I have a multi-threaded C# program that hangs for 5-10 seconds
intermittently. Are there any built in tools in Visual Studio .NET to
somehow instrument my code to see where my performance problems are. It is
rough debugging it using breakpoints due to the multi-threading.


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      6th Jan 2005
zfield,

You can use the CLR profiler to get an idea of how your code is running.
You can find it at the Tools and Utilities page at the .NET Developer Center
on MSDN at (watch for line wrap):

http://msdn.microsoft.com/netframewo...s/default.aspx

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"zfeld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a multi-threaded C# program that hangs for 5-10 seconds
>intermittently. Are there any built in tools in Visual Studio .NET to
>somehow instrument my code to see where my performance problems are. It is
>rough debugging it using breakpoints due to the multi-threading.
>



 
Reply With Quote
 
Dan Bass
Guest
Posts: n/a
 
      6th Jan 2005
To start with I'd give your threads a meaningful name (if at all possible),
then write some sort of debug logger that writes text to disk. From here you
can litter your code with "trace" statements that get logged to a text file.
If you add a time stamp to each entry, you then can trace, from one point in
a thread (using your thread name) to another.

Be sure to make your logging mechanism thread safe.

Here's an example...

#if DEBUG
readonly object grabInterfaceLock = new object();
#endif

public void WriteLog ( string log )
{

#if DEBUG
lock ( grabInterfaceLock )
{
try
{
// filename is...
string filename = @"C:\debuglog.txt";

// prepend the date
log = DateTime.Now.ToString() + " - " + log;

// open up the file and append data
StreamWriter logwriter = File.AppendText(filename);
logwriter.WriteLine( log );
logwriter.Close();
}
catch ( Exception )
{
}
}
#endif

}

"zfeld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a multi-threaded C# program that hangs for 5-10 seconds
>intermittently. Are there any built in tools in Visual Studio .NET to
>somehow instrument my code to see where my performance problems are. It is
>rough debugging it using breakpoints due to the multi-threading.
>



 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      6th Jan 2005
Hi,


take a look at http://www.automatedqa.com/products/aqtime/index.asp I tested
it a time ago and it was very good, unfortunally my company did not purchase
it.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"zfeld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a multi-threaded C# program that hangs for 5-10 seconds
>intermittently. Are there any built in tools in Visual Studio .NET to
>somehow instrument my code to see where my performance problems are. It is
>rough debugging it using breakpoints due to the multi-threading.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
add/remove program hanging =?Utf-8?B?Z2lfd2lsZA==?= Windows XP General 0 27th Jun 2006 04:19 PM
Debugging hanging C# program zfeld Microsoft Dot NET 3 6th Jan 2005 07:45 PM
Program hanging Cat Microsoft C# .NET 3 18th Jun 2004 12:57 PM
Dos program still hanging Npsys Windows XP General 0 18th Nov 2003 09:54 PM
BIG PROBLEM! Debugger hanging on sql server code debugging n_o_s_p_a__m Microsoft C# .NET 0 15th Jul 2003 07:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:47 PM.