[ACCEPTED]-C#/.NET analysis tool to find race conditions/deadlocks-ndepend

Accepted answer
Score: 20

You're probably looking for one of these:

NOTE: This 9 answer is from 2010. As with all recommendations 8 answers, recommendations tend to change 7 over time. There may be other products out 6 there now, CHESS which was a Microsoft Research 5 Labs project may have evolved into a final 4 product or been scrapped altogether. Please 3 take this answer with a grain of salt and 2 conduct new research into which products 1 are suitable now.

Score: 4

Jinx will do this at runtime (not statically) but 1 it may be worth looking at.

Score: 4

I have been experimenting on how to easily 17 track those. I've been working to track 16 some deadlocks, specially on scenarios where 15 many different lock statements are used.

My 14 goal is to detect deadlocks before they 13 happen, e.g. if you have two resources, you 12 know you have to always use them in the 11 same order, otherwise a deadlock might occur.

lock (lockObj1) 
lock (lockObj2) 
    // some code

... somewhere 10 else in the app ...

lock (lockObj2) 
lock (lockObj1) // <- I expect some "possible deadlock" detection here 
    // some code

In this case I'm using 9 lockObj1 then lockObj2 in one place and 8 using them in the opposite order in another 7 place, this is something you will like to 6 avoid in an application Of course, lock 5 statements don't need to be used one after 4 the other like in the example, your complex 3 application might have several complex objects 2 interacting with each other

I have uploaded 1 the code with the test cases here https://github.com/glmnet/LockTracer

Score: 3

You might want to check out CHESS.


Score: 2

See the answers here: What static analysis tools are available for C#?

Some static analysis 2 tools can do deadlock detection.

Also, try 1 FxCop from Microsoft.

Score: 0

Have you looked at Red-Gate Ants? I'm not sure if it 2 will do everything you need but it is a 1 good product to:

  • Identify performance bottlenecks within minutes
  • Optimize .NET application performance
  • Drill down to slow lines of code with line-level timings
  • Profile aspx, ASP.NET, C# code, and VB.NET applications

More Related questions