Program hanging point identification

There is a C#-program which hangs pretty rare. Execution of the program takes place on a remote machines and to start debugger is not an option. Run external profiler is more realistic, but also conjugate with huge difficulties. How can you determine the point of the program hang without profiler or debugger?

Option "detailed logging on FS" is poorly suited. The program consists of about 20 thousand lines of code and hangs not often.

I have tried Process Explorer but it works very strange (or I have not understood it). If you have managed to "catch" the moment when thread entered into an infinite loop, it is possible to see the stack in that moment. But this thread disappears quite quickly (whether in PE or it is really killed by the environment).

The option to create another application, application-monitor, is acceptable. If you can say how to create a dump of the main process or to obtain information about threads of the main process, it would be great. If you have some ready tools, it would be even better.


When an application crashes, it should normally be logged into Window's Application Event Log. It's not extremely detailed, but should give pretty solid clues anyway without any external tools needed.

To get there, you can either search "Event Log" in the Start Menu or find it in the Control Panel. It is located in the Administrative Tools section.

Once you're in the Event Viewer, open the Windows Logs item on the left then select Application. You should be able to find your application in the list using the Source column.

At the bottom you'll find the error detail, timestamp and a couple more infos which can help you debug your application.

Windows Event Log Picture taken from

By 'hang' do you mean the program stops working until it is restarted or that the program pauses for an unusual amount of time. If the latter it could be in a heavy GC collection. If it's the former and you suspect some sort of infinite loop then in task manager (or process explorer) you should see it pretty much eating up one of the processor cores. For example if you have four cores and a program in hung in a tight loop, you will see roughly 25% cpu usage in the performance panel (assuming an otherwise lightly loaded machine).

MS supports managed debugging, see Debugging Managed Code Using the Windows Debugger You can use the sos extension to break the code execution and look at the state of the program. You might want to have the programs pdb handy if you take this approach.


 ? Serial port auto close hangs
 ? IntelliJ Idea 15 hangs when starting and debuging
 ? Powershell Move file to new destination based on trimmed file name
 ? Powershell Move file to new destination based on trimmed file name
 ? Powershell Move file to new destination based on trimmed file name
 ? PowerShell: read lines from text file, construct source and destination file names, then copy files
 ? powershell to move files based on part of file name
 ? Powershell: Move Items Based on Destination from Hashtable
 ? Moving files based on file name with powershell
 ? moving files to new locations based on file name in powershell