[ACCEPTED]-C#/.NET analysis tool to find race conditions/deadlocks-ndepend
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.
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
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.
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
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.