Stm32L4R5 GPIO Interrupt Enable causes issue.(FreeRTOS)

Define “unknown state.” Do you end in a fault handler? If so, the instruction that caused the fault can be identified (but not necessarily the primary cause). Or what else is an “undefined state?” If your sytem is still running in that state and you break via the debugger, what piece of code is it executing?