diff --git a/Directory.Build.props b/Directory.Build.props index 3ca3171cd..f98c95e79 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ 1570;1571;1572;1573;1574;1587;1591;1701;1702;1711;1735;0618 true enable - 4.12.0 + 4.12.1 $(PackageProjectUrl) true true diff --git a/src/Wolverine/Runtime/MessageContext.cs b/src/Wolverine/Runtime/MessageContext.cs index a02283244..5d98c4feb 100644 --- a/src/Wolverine/Runtime/MessageContext.cs +++ b/src/Wolverine/Runtime/MessageContext.cs @@ -38,7 +38,7 @@ private bool hasRequestedReply() private bool isMissingRequestedReply() { - return Outstanding.All(x => x.MessageType != Envelope!.ReplyRequested); + return Outstanding.Concat(_sent ?? []).All(x => x.MessageType != Envelope!.ReplyRequested); } public async Task FlushOutgoingMessagesAsync() @@ -95,11 +95,15 @@ public async Task FlushOutgoingMessagesAsync() await flushScheduledMessagesAsync(); } + _sent ??= new(); + _sent.AddRange(_outstanding); _outstanding.Clear(); _hasFlushed = true; } + private List? _sent; + public async Task AssertAnyRequiredResponseWasGenerated() { if (hasRequestedReply() && _channel is not InvocationCallback && isMissingRequestedReply()) @@ -108,7 +112,7 @@ public async Task AssertAnyRequiredResponseWasGenerated() if (_outstanding.Any()) { failureDescription += "Actual cascading messages were " + - _outstanding.Select(x => x.MessageType).Join(", "); + _outstanding.Concat(_sent ?? []).Select(x => x.MessageType).Join(", "); } else {