From af540bda4638e10c18cf9e651481cd48d02f2c63 Mon Sep 17 00:00:00 2001 From: Garrett Beatty Date: Tue, 7 Jul 2026 19:28:58 -0400 Subject: [PATCH] Skip bin/obj when copying repo for integ-test packaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RuntimeSupport integration test fixture copies the entire repo root into a temp directory (in CicdRelease mode) so dotnet lambda package can resolve the test apps' ProjectReferences. The recursive copy indiscriminately grabbed bin/ and obj/ build outputs. When the integration test projects run in parallel, a concurrent build or Roslyn loading an analyzer (e.g. the newly added Amazon.Lambda.DurableExecution.Analyzers) holds those files open, causing File.CopyTo to throw 'being used by another process' and failing all 24 tests during fixture initialization. Skip bin/obj (alongside the existing .vs skip) — dotnet lambda package regenerates them anyway, so excluding them removes the lock contention and speeds up the copy. --- .../Helpers/LambdaToolsHelper.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/Helpers/LambdaToolsHelper.cs b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/Helpers/LambdaToolsHelper.cs index 5f649d923..29623b06d 100644 --- a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/Helpers/LambdaToolsHelper.cs +++ b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/Helpers/LambdaToolsHelper.cs @@ -51,6 +51,16 @@ public static void CleanUp(string toolPath) } } + /// + /// Directories that are skipped when copying the repo into a temp location for packaging. + /// These are volatile build outputs / IDE state that dotnet lambda package regenerates + /// anyway. Copying them is not only wasteful but unsafe: when integration test projects run in + /// parallel, a concurrent build (or Roslyn loading an analyzer such as + /// Amazon.Lambda.DurableExecution.Analyzers) holds files under bin/obj open, causing + /// File.CopyTo to throw "being used by another process". + /// + private static readonly string[] SkippedDirectories = { ".vs", "bin", "obj" }; + /// /// /// @@ -74,7 +84,7 @@ private static void CopyDirectory(DirectoryInfo dir, string destDirName) foreach (var subdir in dirs) { - if (string.Equals(subdir.Name, ".vs", System.StringComparison.OrdinalIgnoreCase)) + if (System.Array.Exists(SkippedDirectories, name => string.Equals(subdir.Name, name, System.StringComparison.OrdinalIgnoreCase))) continue; var tempPath = Path.Combine(destDirName, subdir.Name);