Comments (8)
I think it's about time to merge in #544, bump the version number to 5.13.1, and make a new release :-)
from stateless.
I think that this should not have happened.
If the state machine is in SubstateA, then the trigger should be handled by the super state handler. So far, so good.
But the state doesn't change, so the state machine should not execute the onEntry action.
So I would say this is a bug.
from stateless.
Thanks
from stateless.
@HenningNT
in an attempt to be helpful I did create this unit test in the Stateless solution. and implemented the fix this way.. .(I'm not super happy with this fix as I'm not sure it is how you might implement this fix. (for example, in the "findhandler" maybe that should somehow return an "ignoretriggerbehaviour" result. trying to have the result.handler.ResultsInTransitionFrom return false cause the "not trigger defined" exception in the default case. Either of those feel better than what I proposed here but I wanted to start the conversation at least"
If you have other suggestions on how this should be addressed I'd be happy to modify my changes and open a PR.
If you like this and would like me to open a PR I'm fine doing that too.
Unit test:
public void WhenInSubstate_TriggerSuperStateTwiceToSameSubstate_DoesNotReenterSubstate()
{
var sm = new StateMachine<State, Trigger>(State.A);
var eCount = 0;
sm.Configure(State.B)
.OnEntry(() => { eCount++;})
.SubstateOf(State.C);
sm.Configure(State.A)
.SubstateOf(State.C);
sm.Configure(State.C)
.Permit(Trigger.X, State.B);
sm.Fire(Trigger.X);
sm.Fire(Trigger.X);
Assert.Equal(1, eCount);
}
code change in statemachine.cs (line 424ish)
case TransitioningTriggerBehaviour _ when result.Handler.ResultsInTransitionFrom(source, args, out destination):
{
//If a trigger was found on a superstate that would cause unintended reentry, don't trigger.
if (source.Equals(destination))
break;
// Handle transition, and set new state
var transition = new Transition(source, destination, trigger, args);
HandleTransitioningTrigger(args, representativeState, transition);
break;
}
from stateless.
Hi, I'm just checking in on this and my pull request. Is there anything more I can be doing to help move this forward? Thanks!
from stateless.
from stateless.
Thanks for the ping. LGTM and tests are passing. I'll give @mclift a chance to review this but I think I understand what's going on now. If I understand it, the superstate is transitioning to itself with TransitioningTriggerBehaviour
because only the primary substate will use the InternalTriggerBehaviour
case which has been set up, so this effectively kills that edge case.
from stateless.
It's been a little while since the last release. There was a discussion about bumping the major version number as we've changed the targeted frameworks to the LTS versions, but on reflection, this probably doesn't warrant a major release on its own. So maybe 5.14.0?
Anyway, I'll get on that :)
from stateless.
Related Issues (20)
- Async EntryActionBehaviour throws InvalidOperationException
- OnEntry does not get fired in a WinForms app HOT 3
- Add Direct License Information In Nuget metadata HOT 5
- RobiniaDocs API Explorer
- Is it possible to change the registered delegation method to event? HOT 2
- Internal state transitions incorrectly list Entry actions in DOT graph export HOT 1
- Intermittent test failure in `LoseSyncContext()` HOT 1
- Handling of value based trigger parameters
- Add NuGet package README
- How To Use dynamic Stateless HOT 5
- [Questions] Queue implementation? HOT 3
- Remove dependency from dirgraph format HOT 2
- Problem with Reentry in PermitDynamic in 5.14 HOT 6
- Add Chinese readme HOT 3
- Reconfigure a state
- Execute guards in parallel? HOT 3
- Mermaid graph support
- Unexpected graph labels for internal transitions HOT 1
- Graph: re-entry transition is missing its entry action HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stateless.