Skip to content

Commit

Permalink
Merge pull request #579 from dotnet-state-machine/dev
Browse files Browse the repository at this point in the history
Release 5.16.0
  • Loading branch information
mclift authored May 24, 2024
2 parents 7d7b44d + 3f1477d commit a8f169d
Show file tree
Hide file tree
Showing 22 changed files with 844 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/BuildAndTestOnPullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
Build_Stateless_solution:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: dotnet restore
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 5.16.0 - 2024.05.24
### Changed
- Permit state reentry from dynamic transitions [#565]
- This is a change in behavior from v5.15.0 (see [#544]); this version restores the previous behavior for `PermitDynamic` that allows reentry;
if reentry is not the desired behavior, consider using a guard condition with `PermitDynamicIf`.
- Remove getDestination, and use Destination property instead (internal refactor) [#575]
### Added
- Add overloads to `FireAsync` to support parameterized trigger arguments [#570]
- Add overloads to `CanFire` to support parameterized trigger arguments [#574]
### Fixed
- Prevent `NullReferenceException` in the `InvocationInfo` class [#566]

## 5.15.0 - 2023.12.29
### Changed
- Updated net6.0 build target to net8.0 [#551]
Expand Down Expand Up @@ -210,6 +222,11 @@ Version 5.10.0 is now listed as the newest, since it has the highest version num
### Removed
### Fixed

[#575]: https://github.com/dotnet-state-machine/stateless/pull/575
[#574]: https://github.com/dotnet-state-machine/stateless/pull/574
[#570]: https://github.com/dotnet-state-machine/stateless/pull/570
[#566]: https://github.com/dotnet-state-machine/stateless/pull/566
[#565]: https://github.com/dotnet-state-machine/stateless/issues/565
[#551]: https://github.com/dotnet-state-machine/stateless/pull/551
[#557]: https://github.com/dotnet-state-machine/stateless/issues/557
[#553]: https://github.com/dotnet-state-machine/stateless/issues/553
Expand Down
4 changes: 2 additions & 2 deletions example/AlarmExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void Main(string[] args)
{
Console.Write("> ");

input = Console.ReadLine();
input = Console.ReadLine()!;

if (!string.IsNullOrWhiteSpace(input))
switch (input.Split(" ")[0])
Expand Down Expand Up @@ -101,7 +101,7 @@ static void WriteFire(string input)
Console.WriteLine($"{input.Split(" ")[1]} is not a valid AlarmCommand.");
}
}
catch (InvalidOperationException ex)
catch (InvalidOperationException)
{
Console.WriteLine($"{input.Split(" ")[1]} is not a valid AlarmCommand to the current state.");
}
Expand Down
3 changes: 1 addition & 2 deletions src/Stateless/DynamicTriggerBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ public DynamicTriggerBehaviour(TTrigger trigger, Func<object[], TState> destinat
TransitionInfo = info ?? throw new ArgumentNullException(nameof(info));
}

public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
public void GetDestinationState(TState source, object[] args, out TState destination)
{
destination = _destination(args);
return true;
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/Stateless/IgnoredTriggerBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ public IgnoredTriggerBehaviour(TTrigger trigger, TransitionGuard transitionGuard
: base(trigger, transitionGuard)
{
}

public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
{
destination = default(TState);
return false;
}
}
}
}
6 changes: 0 additions & 6 deletions src/Stateless/InternalTriggerBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ protected InternalTriggerBehaviour(TTrigger trigger, TransitionGuard guard) : ba
public abstract void Execute(Transition transition, object[] args);
public abstract Task ExecuteAsync(Transition transition, object[] args);

public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
{
destination = source;
return false;
}

public class Sync : InternalTriggerBehaviour
{
public Action<Transition, object[]> InternalAction { get; }
Expand Down
7 changes: 0 additions & 7 deletions src/Stateless/ReentryTriggerBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ public ReentryTriggerBehaviour(TTrigger trigger, TState destination, TransitionG
{
_destination = destination;
}

public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
{
destination = _destination;
return true;
}
}

}
}
4 changes: 3 additions & 1 deletion src/Stateless/Reflection/InvocationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ public string Description
{
if (_description != null)
return _description;
if (MethodName == null)
return "<null>";
if (MethodName.IndexOfAny(new char[] { '<', '>', '`' }) >= 0)
return DefaultFunctionDescription;
return MethodName ?? "<null>";
return MethodName;
}
}

Expand Down
Loading

0 comments on commit a8f169d

Please sign in to comment.