Find Dead Code
find_dead_codeList dead-code suspects on two axes. kinds='type': types with no incoming reference in the reverse type fan-in, the source find_usages reads. kinds='method' (the default): PRIVATE methods whose recorded caller list is empty.
Instructions
List dead-code suspects on two axes. kinds='type': types with no incoming reference in the reverse type fan-in, the source find_usages reads. kinds='method' (the default): PRIVATE methods whose recorded caller list is empty. kinds='all': both.
The default axis skips a private method a framework may call ([RelayCommand] or other framework attributes, partial methods, markup or designer event handlers, static Main, record PrintMembers, ShouldSerialize/Reset) or whose callers were not measured (unresolved references, explicit interface implementations). A nameof in a method's attribute (CanExecute) is a call. *.Designer.cs and *.g.cs files are read for references, never judged.
Returns scope, a 'note' first when there is one, methodsScanned, deadMethods and - when the type axis ran - typesScanned and deadTypes: at most 200 items each (methods: name, declaringType, namespace; types: name, kind, accessibility, namespace, and publicApi:true on a library's public type: outside consumers go unseen, see publicApiNote). Counters, each omitted at zero: what was not judged - methodsIneligible and typesIneligible, each split by reason (methodsIneligibleNotPrivate, -FrameworkInvoked, -UnanalyzedCallers; typesIneligibleStructural, -TestScaffolding, -FrameworkActivated, -MarkupReferenced), typesUnexamined (what the type axis would have judged had it run) - and the candidates the test filter removed, testMethodsFiltered and testTypesFiltered.
A listed candidate is a suspect: the note names what a zero fan-in does not prove and how to confirm one. The type axis exempts what it cannot see being used: interfaces, static classes, *Extensions types, test scaffolding, framework- or reflection-activated and markup-referenced types. An empty answer without a note means at least one axis judged an eligible population and found nothing; for the method axis read methodsIneligible against methodsScanned.
Read-only; works on a recalled session. Test projects are excluded by default. Any other non-blank kinds value runs both axes.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>"
},
"name": "find_dead_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kinds | No | 'method' (default): private methods with a measured, empty caller list - see the description for what that axis does not judge; 'type': types with no incoming reference; 'all': both. | method |
| scope | No | 'solution' (default) or a namespace prefix (e.g. 'MyApp.Core') to narrow scope. | solution |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. | |
| includeTests | No | Include test-project methods/types (default false - production dead-code; a private test-helper without callers is not production dead code). |