A private field is never used
What it finds
A private field that no code reads or writes is dead weight: it costs memory in every instance and suggests a dependency that does not exist. The rule counts uses by name in the whole file; partial types, fields with attributes, fields of structs with an explicit layout, and files that use reflection by name are left alone.
From the rule's source, unused_private_field.rs.
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-field" = "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-field] reason="..."tx0 explain tx0/csharp:unused-private-field shows the same in the terminal. Found a false positive? Report it.