473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Debugging hanging C# program

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.
Jul 21 '05 #1
3 1867
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]
- mv*@spam.guard.caspershouse.com

"zfeld" <zf******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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.

Jul 21 '05 #2
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" <zf******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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.

Jul 21 '05 #3
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" <zf******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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.

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: broebel | last post by:
I'm just wondering, people tell me that helping to debug someone elses program is a really good way to learn to understand the language it's programmed in. My question is: from wich point of...
8
by: briforge | last post by:
I am writing a program for the Palm OS in c++. I have already posted this to a palm development forum but I'm desperate for a fix, so I hope this cross-post isn't offensive. My program is...
3
by: zfeld | last post by:
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...
2
by: nkarkhan | last post by:
Newbie to python here..so bear with me. I used to be able to gdb to a target machine running c/c++ code and see where my program was hanging, crashing, executing.. How do I do that with...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.