4

Consider i have a C# code, I need some tool that would perform an analysis of my code and report bugs and vulnerabilities. Are there any open source tools, something like klocwork.?

7 Answers 7

4

FxCop can perform static analysis of compiled assemblies, ReSharper can analyze your program at source code level. Certain editions of Visual Studio have Code Analysis built into them.

As a sidenote: get up to speed on unit testing (think NUnit et al.)

Sign up to request clarification or add additional context in comments.

Comments

2

fxcop would be my first choice

Comments

1

Yeah, write unit tests and use NUnit to run them. If you're looking for something like static analysis, you should use something like FxCop. You're not going to find a piece of software that will identify bugs automatically for you, but with unit testing and static analysis, you can get pretty close.

2 Comments

"You're not going to find a piece of software that will identify bugs automatically for you"; Actually, PEX can do this. Not all of them, but definitely some. See my reply...
I'm pretty sure that there won't ever be a bit of software that can identify all bugs. Because you know, the halting problem and all. That looks like some interesting software, however.. I'll take a look at it.
1

I use Gendarme

Comments

1

PEX might be a good start - it will attempt to brute-force its way into every code branch; but ultimately, only you know what it is meant to do. You should be writing unit tests as you go, perhaps with NUnit and TestDriven.NET.

Comments

0

FxCop is a static analysis framework available from Microsoft that works on Compiled Assemblies so it's good for any .Net Language

http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx

If you're looking for strictly code analysis you may want to try Style Cop. It's more for ensuring consistency though.

http://code.msdn.microsoft.com/sourceanalysis

Comments

0

In addition to FxCop already mentioned I'd add StyleCop to check if the code matches the coding guidelines. Next there'd be unit testing tools like NUnit or my personal favorite MbUnit or Pex and finally some tool to ensure you've handled all exceptions appropriately - again Pex or Exception Hunter.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.