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…
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.