From 1a4b156170311a519e52e066345d00617b88e6d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amaury=20Lev=C3=A9?= <amauryleve@microsoft.com>
Date: Tue, 24 May 2022 10:26:32 +0200
Subject: [PATCH] Fix expected error message

---
 .../TranslationLayerTests/RunTests.cs                 | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs
index 4204e181ec..200d521897 100644
--- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs
+++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs
@@ -196,7 +196,16 @@ public void RunTestsShouldThrowOnStackOverflowException(RunnerInfo runnerInfo)
             new TestPlatformOptions() { TestCaseFilter = "ExitWithStackoverFlow" },
             _runEventHandler);
 
-        var errorMessage = $"The active test run was aborted. Reason: Test host process crashed : Process is terminating due to StackOverflowException.{Environment.NewLine}";
+        var errorMessage = "The active test run was aborted. Reason: Test host process crashed : ";
+        if (runnerInfo.TargetFramework.StartsWith("netcoreapp2."))
+        {
+            errorMessage += "Process is terminating due to StackOverflowException.";
+        }
+        else
+        {
+            errorMessage += "Process is terminated due to StackOverflowException.";
+        }
+        errorMessage += Environment.NewLine;
 
         Assert.IsTrue(_runEventHandler.Errors.Contains(errorMessage));
     }