-
Notifications
You must be signed in to change notification settings - Fork 791
Description
Hi team,
Firstly, thank you for maintaining Stateless - it’s been my go-to library for building reliable state machines in C# for years.
I wanted to share a concern about PR #618. I was surprised to see PermittedTriggers marked as obsolete, as it now seems Stateless enforces async introspection of permitted triggers even when no async triggers are used.
That makes sense when async triggers are present, but it feels unnecessarily restrictive for purely synchronous workflows.
I also see that ToString blocks on a call to GetPermittedTriggersAsync, which, in my view, is a bit of a code smell.
Many of us use Stateless within domain models to enforce workflow rules. In these designs, it’s common to keep domain logic synchronous and leave async operations to higher layers. Having to introduce blocking workarounds (e.g. via GetAwaiter()) feels awkward in that context.
I really appreciate the effort to support async scenarios - that’s a great feature. It would just be great if the async behaviour could remain completely opt-in without leaking into synchronous use cases. I appreciate I haven't been in the weeds on this project and may not see all of the constraints, but I wonder if a cleaner design might have been to introduce a separate type such as AsyncStateMachine, keeping StateMachine fully synchronous while offering an async variant for those workflows. Just a thought.
Thanks again for all your work on this project!