diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildProcessManager.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildProcessManager.cs index cb276f27cd..cda20de69b 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildProcessManager.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildProcessManager.cs @@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests process.BeginErrorReadLine(); process.BeginOutputReadLine(); - var timeoutTask = Task.Delay(timeout.Value).ContinueWith((t) => + var timeoutTask = Task.Delay(timeout.Value).ContinueWith((t) => { // Don't timeout during debug sessions while (Debugger.IsAttached) @@ -68,15 +68,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Thread.Sleep(TimeSpan.FromSeconds(1)); } - if (process.HasExited) + if (!process.HasExited) { - // This will happen on success, the 'real' task has already completed so this value will - // never be visible. - return (MSBuildResult)null; + // This is a timeout. + process.Kill(); } - // This is a timeout. - process.Kill(); throw new TimeoutException($"command '${process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {timeout}. Output: {output.ToString()}"); });