chickensoft-games / LogicBlocks

Human-friendly, hierarchical state machines for games and apps in C#.
https://www.nuget.org/packages/Chickensoft.LogicBlocks
MIT License
152 stars 6 forks source link

Exceptions thrown from within a state break its flow #23

Closed SkyValor closed 7 months ago

SkyValor commented 7 months ago

When an exception is thrown in an input handler, that state's OnExit() does not get called and the state ends up in a stasis. A transition might still occur and the OnEnter() method from the next state is called.

Also, attempting to re-enter the first state proves unsuccessful, as OnEnter() does not get called, and the StateMachine freezes.

definitelyokay commented 7 months ago

I haven't been able to reproduce this. Please take a look at the scenario I created and see if you can adjust it to be more like yours. See https://github.com/chickensoft-games/LogicBlocks/tree/reproduce/error-handling

definitelyokay commented 7 months ago

Closing this based on our discord conversation :))