usr-local-ΕΨΗΕΛΩΝ
usr-local-ΕΨΗΕΛΩΝ

Reputation: 26924

.NET application hangs and I can't debug it

I'm working on a multithreaded C# server for Syslog. I'm trying to perform a long-running experiment, but I found that after one hour the server hangs (after a certain time, logging stops).

I tried then to run it in Debug mode in Visual Studio and when I found it hanging and tried to press Pause in order to get useful information on where the threads were, Visual Studio said that Remote Debugging Monitor crashed. It's a local application.

What can I do to pause the process and get useful information about thread status?

Upvotes: 3

Views: 3092

Answers (3)

Simon Mourier
Simon Mourier

Reputation: 139296

WinDBG is a good alternative for low level issues that VS cannot trap. You can find more information here: Debugging Tools for Windows

Upvotes: 0

Aliostad
Aliostad

Reputation: 81700

I would try StingyJack's recommendation but I believe there is no replacement for lightweight tracing using Debug.WriteLine() and using Sysinternal's DebugView to see what is happening.

This would be where I would start. VS is not powerful enough to help you debug a multi-threaded service. It can sometimes even lie on the state of objects and bear in mind, when you are debugging, you disrupt the normal flow of events.

Upvotes: 1

StingyJack
StingyJack

Reputation: 19489

Managed stack explorer will poll a managed application and log what is currently happening.

This article may also be useful (section about hang mode dump), but will require debugging a crash dump file (WinDbg is not as easy to absorb as Visual Studio and will take some time to learn).

Upvotes: 3

Related Questions