Skip to content

Commit

Permalink
Merge pull request dotnet-state-machine#566 from PolarGoose/FIx_an_As…
Browse files Browse the repository at this point in the history
…yncActionsFixture_unit_test_and_a_potential_null_reference_exception_in_InvocationInfo_class

Fix NullReferenceException in the InvocationInfo class. Fix a FireAsync_TriggerWithMoreThanThreeParameters test failure because of a different system locale.
  • Loading branch information
mclift authored Apr 22, 2024
2 parents a7b0f09 + 0c11ccb commit 5fa762b
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 @@ -567,7 +568,8 @@ public async Task FireAsyncTriggerWithParametersArray()
[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 5fa762b

Please sign in to comment.