From 5b69fd31169dd07ced917329bbb483f3b73ea98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Thu, 20 Jun 2024 16:48:08 +0200 Subject: [PATCH] Write dll instead of target on abort, rename errors (#5115) --- src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs b/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs index 9801603af0..1443725e62 100644 --- a/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs +++ b/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs @@ -111,8 +111,14 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport } case "run-cancel": + // There is other overload that takes just message, and params, specifying the name of the first parameter explicitly so I don't + // accidentally use it, because that will throw error when message is null, which it always is (We provide that null as first parameter). + Log.LogError(subcategory: null, "TESTRUNCANCEL", null, TestFileFullPath?.ItemSpec ?? string.Empty, 0, 0, 0, 0, data[0]); + break; case "run-abort": - Log.LogError(data[0]); + // There is other overload that takes just message, and params, specifying the name of the first parameter explicitly so I don't + // accidentally use it, because that will throw error when message is null, which it always is (We provide that null as first parameter). + Log.LogError(subcategory: null, "TESTRUNABORT", null, TestFileFullPath?.ItemSpec ?? string.Empty, 0, 0, 0, 0, data[0]); break; case "run-finish": // 0 - Localized summary @@ -222,7 +228,7 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport file ??= string.Empty; // Report error to msbuild. - Log.LogError(null, "VSTEST1", null, file ?? string.Empty, lineNumber, 0, 0, 0, fullErrorMessage, null); + Log.LogError(null, "TESTERROR", null, file ?? string.Empty, lineNumber, 0, 0, 0, fullErrorMessage, null); } break; default: