I optimized an extension method to compare two streams for equality (byte-for-byte) - knowing that this is a hot method I tried to optimize it as far as possible (the streams ca
Problems like this are commonly issues with understanding of how optimizations work. This line of code could very well be being executed because both return false clauses are combined into one set of instructions at the lower level. Other causes for issues like this is if the architecture you are on allows for conditional execution in which certain instructions are hit in the debugger but the results are never committed to registers at the architecture level.
Verify that the code works in debug mode first. Then when you are convinced the outcome is the same as the release mode, look at the underlying instructions to figure out the compiler optimization at hand.