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);