Today I was researching a bug which, in my opinion, was caused by an unnecessary mistake that a compiler could detect.
var isFoo = true;
var bar = 1;
if (isFoo = false && bar > 0) // Compiler is not warning about assignment instead of equality
{
// ...
}
It is not common for values to be set in a condition, so I would like to ask, is it possible to configure Visual Studio to throw warning or error in this case?