Skip to content

Commit

Permalink
* Fix a potential NullReferenceException in the InvocationInfo class
Browse files Browse the repository at this point in the history
* Make FireAsync_TriggerWithMoreThanThreeParameters unit test culturally invariant. Otherwise it fails on some system locales.
  • Loading branch information
PolarGoose committed Feb 4, 2024
1 parent 66eee8f commit 0c11ccb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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
4 changes: 3 additions & 1 deletion test/Stateless.Tests/AsyncActionsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;

using Xunit;
using System.Globalization;

namespace Stateless.Tests
{
Expand Down Expand Up @@ -544,7 +545,8 @@ public async Task OnEntryFromAsync_WhenEnteringByAnotherTrigger_InvokesAction()
[Fact]
public async Task FireAsync_TriggerWithMoreThanThreeParameters()
{
const string expectedParam = "42-Stateless-True-420.69-Y";
var decimalSeparator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
string expectedParam = $"42-Stateless-True-420{decimalSeparator}69-Y";
string actualParam = null;

var sm = new StateMachine<State, Trigger>(State.A);
Expand Down

0 comments on commit 0c11ccb

Please sign in to comment.