Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open source Tool to find unreachable/unused c# code [closed]

Tags:

c#

is there any Open source static code analysis tool that can help to find unreachable /unused code in C# programs?

like image 485
balalakshmi Avatar asked Nov 10 '09 07:11

balalakshmi


2 Answers

FxCop, which is built into higher editions of Visual Studio, will warn of unused private or internal members. Right-click your project and choose Run Code Analysis. In conjunction with "unreachable code segments" being identified by the compiler as others have noted, this should catch the remaining unused code.

(Note FxCop will not warn of unused public or protected members, because these could be part of an API intended for use by external callers. Also, FxCop is not available in all editions of Visual Studio though older versions are available for download.)

like image 184
itowlson Avatar answered Nov 12 '22 17:11

itowlson


The best I can suggest is a code coverage tool used on the main executable instead of a test assembly, then put the application through it's paces... A static analysis of code would be NP hard to do in some more esoteric cases.

like image 38
Matthew Scharley Avatar answered Nov 12 '22 18:11

Matthew Scharley