Is there a tool for finding unreferenced functions (dead, obsolete code) in a C# app? [closed]

Gendarme will detect private methods with no upstream callers. It is available cross platform, and the latest version handles "AvoidUncalledPrivateCodeRule".

FxCop will detect public/protected methods with no upstream callers. However, FxCop does not detect all methods without upstream callers, as it is meant to check in the case that your code is part of a Library, so public members are left out. You can use NDepend to do a search for public members with no upstream callers, which I detail here in this other StackOverflow answer.

(edit: added information about Gendarme which actually does what the questioner asked)


NDepend will also report on potentially unused code.


Bear in mind that Resharper (and probably other similar tools as well) will not highlight unused methods if the methods are marked public. There is no way a static code analysis tool will be able to check whether the methods of your assembly are used by other assemblies outside your solution. So the first step in weeding out unused methods is to reduce their visibility to private or internal.