From c8118da7b9369e2d833cfb77592d26349df02df6 Mon Sep 17 00:00:00 2001 From: Teneko Date: Fri, 9 Oct 2026 05:05:34 +0200 Subject: [PATCH 1/2] fix(tests): disable MSBuild node reuse for spawned builds The ref project build tests and the package layout fixture spawn `dotnet build`/`dotnet pack` with redirected stdout/stderr. MSBuild worker nodes started with node reuse outlive the build and inherit those pipes, so reading the streams to the end blocked until the nodes hit their idle timeout. Set MSBUILDDISABLENODEREUSE=1 for the spawned processes and drain stderr concurrently in PackageLayoutFixture to avoid a full-pipe deadlock. Co-Authored-By: Claude Opus 5.5 --- .../Infrastructure/PackageLayoutFixture.cs | 10 ++++++++-- .../RefProjectBuildTests.cs | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Infrastructure/PackageLayoutFixture.cs b/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Infrastructure/PackageLayoutFixture.cs index 2ba1712..164549e 100644 --- a/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Infrastructure/PackageLayoutFixture.cs +++ b/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Infrastructure/PackageLayoutFixture.cs @@ -53,14 +53,20 @@ private static ProcessResult RunProcess(string fileName, string arguments) CreateNoWindow = true }; + // Reused MSBuild nodes outlive the build and inherit the redirected pipes, so reading + // stdout/stderr to the end would block until their idle timeout expires. + startInfo.Environment["MSBUILDDISABLENODEREUSE"] = "1"; + using var process = new Process { StartInfo = startInfo }; process.Start(); + // Drain both streams concurrently; reading them one after another can deadlock once the + // other pipe's buffer is full. + var error = process.StandardError.ReadToEndAsync(); var output = process.StandardOutput.ReadToEnd(); - var error = process.StandardError.ReadToEnd(); process.WaitForExit(); - return new ProcessResult(process.ExitCode, string.Concat(output, error)); + return new ProcessResult(process.ExitCode, string.Concat(output, error.Result)); } private sealed record ProcessResult(int ExitCode, string Output); diff --git a/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/RefProjectBuildTests.cs b/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/RefProjectBuildTests.cs index 3496c34..02d9efd 100644 --- a/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/RefProjectBuildTests.cs +++ b/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/RefProjectBuildTests.cs @@ -66,6 +66,10 @@ private static ProcessResult RunProcess( CreateNoWindow = true }; + // Reused MSBuild nodes outlive the build and inherit the redirected pipes, so reading + // stdout/stderr to the end would block until their idle timeout expires. + process.StartInfo.Environment["MSBUILDDISABLENODEREUSE"] = "1"; + process.Start(); var stdOut = process.StandardOutput.ReadToEndAsync(); var stdErr = process.StandardError.ReadToEndAsync(); From 6b2715c24b1b2dbe5c30af8e53f593cd3ade7759 Mon Sep 17 00:00:00 2001 From: Teneko Date: Fri, 9 Oct 2026 05:10:02 +0200 Subject: [PATCH 2/2] fix(tests): roll test host forward to newer .NET runtimes The Coverage workflow runs the tests in the mcr.microsoft.com/dotnet/sdk:10.0 image, which only ships the .NET 10 runtime. The net8.0 test host could not start there ("You must install or update .NET to run this application"). Keep net8.0 as the test target framework and set RollForward=Major so the tests run on the newest installed runtime. Co-Authored-By: Claude Opus 5.5 --- .../Tenekon.MethodOverloads.SourceGenerator.Tests.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Tenekon.MethodOverloads.SourceGenerator.Tests.csproj b/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Tenekon.MethodOverloads.SourceGenerator.Tests.csproj index 20096b0..895fcdb 100644 --- a/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Tenekon.MethodOverloads.SourceGenerator.Tests.csproj +++ b/tests/Tenekon.MethodOverloads.SourceGenerator.Tests/Tenekon.MethodOverloads.SourceGenerator.Tests.csproj @@ -1,6 +1,8 @@  net8.0 + + Major preview enable enable