roslyn:find_unused_code
Analyze .NET projects or solutions to identify unused types, methods, properties, and fields with zero references. Filter results by project, symbol kind, or accessibility to remove dead code and reduce maintenance overhead.
Instructions
Find unused types, methods, properties, and fields in a project or entire solution. Returns symbols with zero references (excluding their declaration).
USAGE: find_unused_code() for entire solution, or find_unused_code(projectName="MyProject") for specific project. OUTPUT: List of unused symbols with location, kind, and accessibility. Default limit: 50 results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxResults | No | Maximum results to return (default: 50, helps manage large outputs) | |
| projectName | No | Optional: analyze specific project by name, omit to analyze entire solution | |
| includePrivate | No | Include private members (default: true) | |
| includeInternal | No | Include internal members (default: false - usually want to keep internal APIs) | |
| symbolKindFilter | No | Optional: filter by symbol kind (Class, Method, Property, Field) |