Skip to content

Commit

Permalink
fixed behaviour of Raise.Event for asynchronous event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartschinke committed May 7, 2024
1 parent 24dc639 commit 86a6a8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/NSubstitute/Routing/Handlers/RaiseEventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Threading.Tasks;
using NSubstitute.Core;
using NSubstitute.Exceptions;

Expand Down Expand Up @@ -35,7 +36,7 @@ public RouteAction Handle(ICall call)

try
{
handler.DynamicInvoke(eventArguments);
(handler.DynamicInvoke(eventArguments) as Task)?.GetAwaiter().GetResult();
}
catch (TargetInvocationException e)
{
Expand Down

0 comments on commit 86a6a8e

Please sign in to comment.