This is an automated email from the ASF dual-hosted git repository.
RongtongJin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new 061dd503 [C#] Fix missing return after InvalidReceiptHandle in
AckMessage and ChangeInvisibleDuration (#1267)
061dd503 is described below
commit 061dd5031be452f229cf69612eb5af0b962b5337
Author: guyinyou <[email protected]>
AuthorDate: Thu Jun 11 15:38:30 2026 +0800
[C#] Fix missing return after InvalidReceiptHandle in AckMessage and
ChangeInvisibleDuration (#1267)
Both methods in ProcessQueue.cs had a fall-through bug where the
InvalidReceiptHandle branch called tcs.SetException() but did not return,
causing execution to continue into the subsequent 'if (statusCode !=
Code.Ok)'
block. This resulted in an unnecessary call to AckMessageLater /
ChangeInvisibleDurationLater with an already-faulted TaskCompletionSource,
which would throw an InvalidOperationException at runtime.
Add the missing 'return;' statements to match the behavior of the Java
reference implementation, where each non-success branch explicitly returns
after resolving the future.
Co-authored-by: guyinyou <[email protected]>
---
csharp/rocketmq-client-csharp/ProcessQueue.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/csharp/rocketmq-client-csharp/ProcessQueue.cs
b/csharp/rocketmq-client-csharp/ProcessQueue.cs
index 44d72278..830f96c7 100644
--- a/csharp/rocketmq-client-csharp/ProcessQueue.cs
+++ b/csharp/rocketmq-client-csharp/ProcessQueue.cs
@@ -400,6 +400,7 @@ namespace Org.Apache.Rocketmq
$" attempt={attempt}, mq={_mq},
endpoints={endpoints}, requestId={requestId}," +
$" status message={status.Message}");
tcs.SetException(new
BadRequestException((int)statusCode, requestId, status.Message));
+ return;
}
if (statusCode != Code.Ok)
@@ -498,6 +499,7 @@ namespace Org.Apache.Rocketmq
$" messageId={messageId},
attempt={attempt}, mq={_mq}, endpoints={endpoints}," +
$" requestId={requestId}, status
message={status.Message}");
tcs.SetException(new
BadRequestException((int)statusCode, requestId, status.Message));
+ return;
}
if (statusCode != Code.Ok)