Two comparisons are joined with & or |, which evaluate both sides where && and || would stop early

tx0/csharp:eager-boolean-operatorrecommendedwarningreliability/logicdepth fastbug

What it finds

On booleans, & and | evaluate both operands. In x != null & x.Length > 0 the right side runs even when x is null and throws. When both operands are comparisons, && and || are almost always what was meant; code that needs both sides evaluated for their effects is a deliberate use.

From the rule's source, eager_boolean_operator.rs.

Example from the rule's tests
class Checks{    bool Valid(string s) => s != null & s.Length > 0;tx0 reports: s != null & s.Length > 0 evaluates both sides; && stops early     bool Short(string s) => s != null && s.Length > 0;     int Mask(int a, int b) => a & b;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/csharp:eager-boolean-operator" = "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:eager-boolean-operator] reason="..."

tx0 explain tx0/csharp:eager-boolean-operator shows the same in the terminal. Found a false positive? Report it.