Main Site Documentation

0.11 Bug: Debug.Assert false trigger


#1

I seem to have found a bug with Debug.Assert. On doing a boolean check, it does an assert even though the evaluation should have been false…


#2

If I’m looking at your program right, it’s behaving as expected. Since IsCompressorOn evaluates to false, you’re checking if false == true, which it doesn’t. According to https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debug.assert the assert should trigger when condition is false, not true.

I believe you want p.IsCompressorOn == false or !p.IsCompressorOn. You’re asserting that it’s not on.