From 7c4e2f46bc1358f45a916f58a80c1c1148cadb73 Mon Sep 17 00:00:00 2001 From: westey <164392973+westey-m@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:53:45 +0000 Subject: [PATCH] Address PR comments --- .../ConsoleAppSamplesValidation.cs | 9 +++++++-- .../SamplesValidation.cs | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/ConsoleAppSamplesValidation.cs b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/ConsoleAppSamplesValidation.cs index 2f509962eb..44c0fb116d 100644 --- a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/ConsoleAppSamplesValidation.cs +++ b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/ConsoleAppSamplesValidation.cs @@ -832,12 +832,17 @@ private async Task BuildSampleAsync(string samplePath) using Process buildProcess = new() { StartInfo = buildInfo }; buildProcess.Start(); + + // Read both streams asynchronously to avoid deadlocks from filled pipe buffers + Task stdoutTask = buildProcess.StandardOutput.ReadToEndAsync(); + Task stderrTask = buildProcess.StandardError.ReadToEndAsync(); await buildProcess.WaitForExitAsync(); + string stderr = await stderrTask; if (buildProcess.ExitCode != 0) { - string stderr = await buildProcess.StandardError.ReadToEndAsync(); - throw new InvalidOperationException($"Failed to build sample at {samplePath}: {stderr}"); + string stdout = await stdoutTask; + throw new InvalidOperationException($"Failed to build sample at {samplePath}:\n{stdout}\n{stderr}"); } this._outputHelper.WriteLine($"Build completed for {samplePath}."); diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs index 5b1e46ebf0..919f66f30b 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs @@ -830,12 +830,17 @@ private async Task BuildSampleAsync(string samplePath) using Process buildProcess = new() { StartInfo = buildInfo }; buildProcess.Start(); + + // Read both streams asynchronously to avoid deadlocks from filled pipe buffers + Task stdoutTask = buildProcess.StandardOutput.ReadToEndAsync(); + Task stderrTask = buildProcess.StandardError.ReadToEndAsync(); await buildProcess.WaitForExitAsync(); + string stderr = await stderrTask; if (buildProcess.ExitCode != 0) { - string stderr = await buildProcess.StandardError.ReadToEndAsync(); - throw new InvalidOperationException($"Failed to build sample at {samplePath}: {stderr}"); + string stdout = await stdoutTask; + throw new InvalidOperationException($"Failed to build sample at {samplePath}:\n{stdout}\n{stderr}"); } this._outputHelper.WriteLine($"Build completed for {samplePath}.");