else if conditional passing even though the conditions haven't been met?

It’s probably just a debugger thing

If you disable optimization around your function you should be able to see the actual path of the code and the relevant values

My guess is that CurrentState has been optimized away so it shows as None

And I’m guessing that the compile verbosity of LogPW stops it from being compiled, which is why the breakpoint at line 266 isn’t hit