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: