diff --git a/eng/helix/content/RunTests/ProcessUtil.cs b/eng/helix/content/RunTests/ProcessUtil.cs index 8ac00bf829c3..416ec05a9087 100644 --- a/eng/helix/content/RunTests/ProcessUtil.cs +++ b/eng/helix/content/RunTests/ProcessUtil.cs @@ -59,6 +59,12 @@ public static Task CaptureDumpAsync(int pid, string dumpFilePath) return Task.CompletedTask; } + if (!File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump") && + !File.Exists($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump.exe")) + { + return Task.CompletedTask; + } + return RunAsync($"{Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT")}/dotnet-dump", $"collect -p {pid} -o \"{dumpFilePath}\""); } diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 2811fa3110d5..1a98743cab84 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -126,6 +126,15 @@ public async Task InstallDotnetToolsAsync() { try { + // Install dotnet-dump first so we can catch any failures from running dotnet after this (installing tools, running tests, etc.) + await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", + $"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*", + environmentVariables: EnvironmentVariables, + outputDataReceived: Console.WriteLine, + errorDataReceived: Console.Error.WriteLine, + throwOnError: false, + cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); + Console.WriteLine($"Adding current directory to nuget sources: {Options.HELIX_WORKITEM_ROOT}"); await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", @@ -161,13 +170,6 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", throwOnError: false, cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); - await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", - $"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*", - environmentVariables: EnvironmentVariables, - outputDataReceived: Console.WriteLine, - errorDataReceived: Console.Error.WriteLine, - throwOnError: false); - return true; } catch (Exception e)