A private method is never called
What it finds
A private method that nothing in its file calls is dead code: only its own type could call it. The rule counts uses by name in the whole file, so overloads keep each other alive. Partial types, methods with attributes, Unity message methods, methods named in strings such as a [DebuggerDisplay] text, and files that look up members by name through reflection are left alone.
From the rule's source, unused_private_method.rs.
class Report{ public string Render() => Header(); private string Header() => "head"; private string Footer() => "foot";tx0 reports: the private method Footer is never called} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:unused-private-method" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:unused-private-method] reason="..."tx0 explain tx0/csharp:unused-private-method shows the same in the terminal. Found a false positive? Report it.