dotnet-state-machine / stateless

A simple library for creating state machines in C# code
Other
5.6k stars 766 forks source link

InitialTransition in FiringMode.Immediate causes infinite loop #515

Closed leeoades closed 1 year ago

leeoades commented 1 year ago

Adjusting the unit test in InitialTransitionFixture.cs to set the firing more to Immediate demonstrates this issue.

        [Fact]
        public void EntersSubState()
        {
            var sm = new StateMachine<State, Trigger>(State.A, FiringMode.Immediate);

            sm.Configure(State.A).Permit(Trigger.X, State.B);

            sm.Configure(State.B)
                .InitialTransition(State.C);

            sm.Configure(State.C)
                .SubstateOf(State.B);

            sm.Fire(Trigger.X);
            Assert.Equal(State.C, sm.State);
        }
DeepakParamkusam commented 1 year ago

Appears to be duplicate of #439. I had found the probable cause, but couldn't fix it.