Skip to content

Commit a8f169d

Browse files
authored
Merge pull request #579 from dotnet-state-machine/dev
Release 5.16.0
2 parents 7d7b44d + 3f1477d commit a8f169d

22 files changed

+844
-137
lines changed

.github/workflows/BuildAndTestOnPullRequests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
Build_Stateless_solution:
1111
runs-on: windows-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- name: Install dependencies
1616
run: dotnet restore

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 5.16.0 - 2024.05.24
8+
### Changed
9+
- Permit state reentry from dynamic transitions [#565]
10+
- This is a change in behavior from v5.15.0 (see [#544]); this version restores the previous behavior for `PermitDynamic` that allows reentry;
11+
if reentry is not the desired behavior, consider using a guard condition with `PermitDynamicIf`.
12+
- Remove getDestination, and use Destination property instead (internal refactor) [#575]
13+
### Added
14+
- Add overloads to `FireAsync` to support parameterized trigger arguments [#570]
15+
- Add overloads to `CanFire` to support parameterized trigger arguments [#574]
16+
### Fixed
17+
- Prevent `NullReferenceException` in the `InvocationInfo` class [#566]
18+
719
## 5.15.0 - 2023.12.29
820
### Changed
921
- Updated net6.0 build target to net8.0 [#551]
@@ -210,6 +222,11 @@ Version 5.10.0 is now listed as the newest, since it has the highest version num
210222
### Removed
211223
### Fixed
212224

225+
[#575]: https://github.com/dotnet-state-machine/stateless/pull/575
226+
[#574]: https://github.com/dotnet-state-machine/stateless/pull/574
227+
[#570]: https://github.com/dotnet-state-machine/stateless/pull/570
228+
[#566]: https://github.com/dotnet-state-machine/stateless/pull/566
229+
[#565]: https://github.com/dotnet-state-machine/stateless/issues/565
213230
[#551]: https://github.com/dotnet-state-machine/stateless/pull/551
214231
[#557]: https://github.com/dotnet-state-machine/stateless/issues/557
215232
[#553]: https://github.com/dotnet-state-machine/stateless/issues/553

example/AlarmExample/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void Main(string[] args)
2121
{
2222
Console.Write("> ");
2323

24-
input = Console.ReadLine();
24+
input = Console.ReadLine()!;
2525

2626
if (!string.IsNullOrWhiteSpace(input))
2727
switch (input.Split(" ")[0])
@@ -101,7 +101,7 @@ static void WriteFire(string input)
101101
Console.WriteLine($"{input.Split(" ")[1]} is not a valid AlarmCommand.");
102102
}
103103
}
104-
catch (InvalidOperationException ex)
104+
catch (InvalidOperationException)
105105
{
106106
Console.WriteLine($"{input.Split(" ")[1]} is not a valid AlarmCommand to the current state.");
107107
}

src/Stateless/DynamicTriggerBehaviour.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ public DynamicTriggerBehaviour(TTrigger trigger, Func<object[], TState> destinat
1717
TransitionInfo = info ?? throw new ArgumentNullException(nameof(info));
1818
}
1919

20-
public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
20+
public void GetDestinationState(TState source, object[] args, out TState destination)
2121
{
2222
destination = _destination(args);
23-
return true;
2423
}
2524
}
2625
}

src/Stateless/IgnoredTriggerBehaviour.cs

-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ public IgnoredTriggerBehaviour(TTrigger trigger, TransitionGuard transitionGuard
88
: base(trigger, transitionGuard)
99
{
1010
}
11-
12-
public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
13-
{
14-
destination = default(TState);
15-
return false;
16-
}
1711
}
1812
}
1913
}

src/Stateless/InternalTriggerBehaviour.cs

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ protected InternalTriggerBehaviour(TTrigger trigger, TransitionGuard guard) : ba
1414
public abstract void Execute(Transition transition, object[] args);
1515
public abstract Task ExecuteAsync(Transition transition, object[] args);
1616

17-
public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
18-
{
19-
destination = source;
20-
return false;
21-
}
22-
2317
public class Sync : InternalTriggerBehaviour
2418
{
2519
public Action<Transition, object[]> InternalAction { get; }

src/Stateless/ReentryTriggerBehaviour.cs

-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ public ReentryTriggerBehaviour(TTrigger trigger, TState destination, TransitionG
1414
{
1515
_destination = destination;
1616
}
17-
18-
public override bool ResultsInTransitionFrom(TState source, object[] args, out TState destination)
19-
{
20-
destination = _destination;
21-
return true;
22-
}
2317
}
24-
2518
}
2619
}

src/Stateless/Reflection/InvocationInfo.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ public string Description
6363
{
6464
if (_description != null)
6565
return _description;
66+
if (MethodName == null)
67+
return "<null>";
6668
if (MethodName.IndexOfAny(new char[] { '<', '>', '`' }) >= 0)
6769
return DefaultFunctionDescription;
68-
return MethodName ?? "<null>";
70+
return MethodName;
6971
}
7072
}
7173

0 commit comments

Comments
 (0)