vTaskDelay causes proteus simulation to crash

I used debug mode and checked variables, xMode that stores pin reading, it has 1 when the switch is on and 0 when off, when I put a break point inside the if conditions it doesn’t stop there for debugging