Possible Duplicate:
C#/.NET analysis tool to find race conditions/deadlocks
I am debugging an application that I suspect is getting deadlocked and hanging. However, this only occurs every few days, and it never happens on my computer so I can’t hook a debugger up to it. Are there any utilities or methods I can use to query the running application and find out what methods/locks/whatever it is deadlocked on?
Update: Typically the application is running at a customer location and I don’t have access to the machine, and I’m not entirely comfortable asking them to install tons of software.
Instead of using the regular
lock&Monitor.Enterapproach to lock some data, you can also use a ‘TimedLock’ structure. This TimedLock throws an exception if the lock couldn’t be acquired in a timely fashion, and it can also give you a warning if you have some locks that you didn’t release.This article by Ian Griffiths could maybe help.