A sealed class declares a new protected member, which no subclass can ever use
What it finds
protected grants access to subclasses, and a sealed class has none. A new protected member there is effectively private but says otherwise. Overrides keep their accessibility and are left alone.
From the rule's source, sealed_type_protected_member.rs.
sealed class Leaf{ protected void Grow() { }tx0 reports: Grow is protected in the sealed class Leaf private void Fall() { }} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:sealed-type-protected-member" = "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:sealed-type-protected-member] reason="..."tx0 explain tx0/csharp:sealed-type-protected-member shows the same in the terminal. Found a false positive? Report it.