Rider Help

Code Inspection: Expression is always 'true' or always 'false'

This inspection is fairly obvious: Rider analyzes values and nullability of symbols and suggests to eliminate expressions that are always true or always false.

The only problem with this inspection is that sometimes it's not obvious how Rider has come to this conclusion, and hence the unwillingness to accept its suggestion to replace an expression with explicit true or false, or remove a redundant check in an if statement. Below are some StackOverflow questions that illustrate this problem:

Last modified: 11 October 2017

See Also