views:

1036

answers:

4
+5  Q: 

Lint for C#

Is there a lint-like tool for C#? I've got the compiler to flag warnings-as-errors, and I've got Stylecop, but these only catch the most egregious errors. Are there any other must-have tools (especially for newbie C#ers like me) that point out probably-dumb things I'm doing?

+6  A: 

Tried FxCop? It's integrated into VS as "Code Analysis"

Mehrdad Afshari
I don't use VS but since you got 4 upvotes in 17 minutes it probably deserves a try. Installing it now, thanks!
Ken
It works without VS too. But VS is a great tool for .NET development.
Mehrdad Afshari
I think it would be pretty hard to convince me that VS (which I have tried, and disliked) is better than Emacs + 15 years of customizations. It would probably be easier to get me to change keyboard layouts!
Ken
BTW, while you might be comfortable with writing code in Emacs, .NET development is much more than just coding. You can always have VS at hand for visual debugging and other stuff. It doesn't hurt.
Mehrdad Afshari
Link for FxCop 10.0 (for .NET 4.0, it's in the 7.1 SDK): http://blogs.msdn.com/b/codeanalysis/archive/2010/07/26/fxcop-10-0-is-available.aspx
JohnB
+6  A: 

Resharper performs a fair bit of static analysis as well as doing a ton of other useful things. Currently I wouldn't code in C# without it.

As well as FxCop, Gendarme is another tool to look at (it is Mono's version of FxCop but they are different in approach and the errors that they actually find).

Kris Erickson
+2  A: 

Gedarme is similar to FxCop

Nathan Koop
A: 

You can try .Net Reflector by Red-Gate, you can get it from here. Many useful plugins for .Net Reflector are available on CodePlex which you can get it from here.

this. __curious_geek
I use Reflector all the time, but AFAICT it's just for inspecting compiled code. Is there some "show me my stupid mistakes" module I'm missing?
Ken
Good lord yes. I don't know what you need to do to turn it on (more like, what you've done to turn it off), but dig for it, it's terrific.
Robert Rossney