Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am looking for an open source tool that can scan my code and determine unused code in 4 solutions (3 are referenced by one solution ) I would like to know what methods are not used, and what classes are not used so I can streamline things to make it easier to maintain. Any help is appreciated.
Posted

1 solution

You can consider this list and review each suggested product:
https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#.NET[^],
see also http://bfy.tw/dKE[^].

I personally only used FxCop; I simply don't remember if dead code is detected, probably it should. This product has some problems but is quite usable and can be considered useful, recommended.

I also tried StyleCop and found it extremely stupid (well, the version I tried), won't recommend it. I would really recommend to try all other tools.

Now, you also need to understand this: even though elimination of all the dead code would be the decent approach, dead code in .NET is less of a problem. This is because .NET is based on JIT-compilation. If some method is never called, it will never be JIT-compiled. Please see: https://en.wikipedia.org/wiki/Just-in-time_compilation[^].

You probably understand that the compiler along cannot eliminate dead code. If some members are private and never used, the compiler will detect it, as well as unused or uninitialized local variables. But non-private members, want be detected as unused, by quite apparent reasons. Removing unused declaration is not the only goal of static analysis of the code. For example, you can keep all access modifiers tight, so no member or type used only internally in the assembly would be allowed to declared public. But this kind of criteria, apparently, cannot be applied based on a separate assembly.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900