From 33ee62a0973ec8a60923c248772122e08189ccc6 Mon Sep 17 00:00:00 2001 From: Chris Rickman Date: Thu, 30 Oct 2025 11:05:46 -0700 Subject: [PATCH 1/3] Fixed --- .../Agents/Orchestration/OrchestrationResult.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dotnet/src/Agents/Orchestration/OrchestrationResult.cs b/dotnet/src/Agents/Orchestration/OrchestrationResult.cs index 978e7bcca74b..755e164c963b 100644 --- a/dotnet/src/Agents/Orchestration/OrchestrationResult.cs +++ b/dotnet/src/Agents/Orchestration/OrchestrationResult.cs @@ -73,12 +73,24 @@ public async ValueTask GetValueAsync(TimeSpan? timeout = null, Cancellat if (timeout.HasValue) { - Task[] tasks = { this._completion.Task }; - if (!Task.WaitAll(tasks, timeout.Value)) +#if NET + try + { + await this._completion.Task.WaitAsync(timeout.Value, cancellationToken).ConfigureAwait(false); + } + catch (TimeoutException) + { + this._logger.LogOrchestrationResultTimeout(this.Orchestration, this.Topic); + throw; + } +#else + Task completedTask = await Task.WhenAny(this._completion.Task, Task.Delay(timeout.Value, cancellationToken)).ConfigureAwait(false); + if (completedTask != this._completion.Task) { this._logger.LogOrchestrationResultTimeout(this.Orchestration, this.Topic); throw new TimeoutException($"Orchestration did not complete within the allowed duration ({timeout})."); } +#endif } this._logger.LogOrchestrationResultComplete(this.Orchestration, this.Topic); From d4cd97239862b02134619cb06021d57f771b94ce Mon Sep 17 00:00:00 2001 From: Chris Rickman Date: Thu, 30 Oct 2025 11:25:17 -0700 Subject: [PATCH 2/3] Test fix --- .../Agents/UnitTests/Orchestration/OrchestrationResultTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs b/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs index 69471949847c..09a776e7b24b 100644 --- a/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs +++ b/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs @@ -77,7 +77,7 @@ public async Task GetValueAsync_WithTimeout_ThrowsTimeoutException_WhenTaskDoesN // Act & Assert TimeoutException exception = await Assert.ThrowsAsync(() => result.GetValueAsync(timeout).AsTask()); - Assert.Contains("Orchestration did not complete within the allowed duration", exception.Message); + } [Fact] From ccd2f4d9eec607ccccf2522492924ebf53c2bc97 Mon Sep 17 00:00:00 2001 From: Chris Rickman Date: Thu, 30 Oct 2025 11:31:33 -0700 Subject: [PATCH 3/3] Format --- .../Agents/UnitTests/Orchestration/OrchestrationResultTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs b/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs index 09a776e7b24b..d65a2c5e8b8c 100644 --- a/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs +++ b/dotnet/src/Agents/UnitTests/Orchestration/OrchestrationResultTests.cs @@ -77,7 +77,6 @@ public async Task GetValueAsync_WithTimeout_ThrowsTimeoutException_WhenTaskDoesN // Act & Assert TimeoutException exception = await Assert.ThrowsAsync(() => result.GetValueAsync(timeout).AsTask()); - } [Fact]