diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsCommandLineProvider.cs index 3727cd22fd..3a6fc76e97 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsCommandLineProvider.cs @@ -44,5 +44,14 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com } public Task ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions) - => ValidationResult.ValidTask; + { + if (!commandLineOptions.IsOptionSet(AzureDevOpsCommandLineOptions.AzureDevOpsOptionName) && + commandLineOptions.IsOptionSet(AzureDevOpsCommandLineOptions.AzureDevOpsReportSeverity)) + { + // If report-azdo is not set, but report-azdo-severity is set, it's invalid. + return ValidationResult.InvalidTask(AzureDevOpsResources.AzureDevOpsReportSeverityRequiresAzureDevOps); + } + + return ValidationResult.ValidTask; + } } diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsReporter.cs b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsReporter.cs index f167387ea9..5b7e8684b6 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsReporter.cs +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsReporter.cs @@ -119,10 +119,8 @@ private async Task WriteExceptionAsync(string? explanation, Exception? exception } string stackTrace = exception.StackTrace; - int index = stackTrace.IndexOfAny(NewlineCharacters); - string firstLine = index == -1 ? stackTrace : stackTrace.Substring(0, index); - - (string Code, string File, int LineNumber)? location = GetStackFrameLocation(firstLine); + string[] lines = stackTrace.Split(NewlineCharacters, StringSplitOptions.RemoveEmptyEntries); + (string Code, string File, int LineNumber)? location = lines.Select(GetStackFrameLocation).FirstOrDefault(location => location is not null); if (location != null) { string root = RootFinder.Find(); @@ -145,19 +143,21 @@ private async Task WriteExceptionAsync(string? explanation, Exception? exception return null; } - bool weHaveFilePathAndCodeLine = !RoslynString.IsNullOrWhiteSpace(match.Groups["code"].Value); + string code = match.Groups["code"].Value; + bool weHaveFilePathAndCodeLine = !RoslynString.IsNullOrWhiteSpace(code); if (!weHaveFilePathAndCodeLine) { return null; } - if (RoslynString.IsNullOrWhiteSpace(match.Groups["file"].Value)) + string file = match.Groups["file"].Value; + if (RoslynString.IsNullOrWhiteSpace(file) || !File.Exists(file)) { return null; } int line = int.TryParse(match.Groups["line"].Value, out int value) ? value : 0; - return (match.Groups["code"].Value, match.Groups["file"].Value, line); + return (code, file, line); } } diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/AzureDevOpsResources.resx b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/AzureDevOpsResources.resx index 8114f1a73b..cc27c6c8b4 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/AzureDevOpsResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/AzureDevOpsResources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + '--report-azdo-severity' requires '--report-azdo' to be enabled + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.cs.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.cs.xlf index 2da6635166..15ba4fc3ef 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.cs.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Generátor sestav Azure DevOps pro zápis chyb do výstupu způsobem, který je pro AzureDev Ops srozumitelný. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.de.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.de.xlf index 0ab8ac9a62..ecf37ebd84 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.de.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Azure DevOps-Berichts-Generator, um Fehler auf eine Weise in die Ausgabe zu schreiben, die AzureDev Ops versteht. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.es.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.es.xlf index 7ccfdb2b43..7f8f4bf614 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.es.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. El generador de informes de Azure DevOps escribe errores en la salida de una manera que AzureDev Ops comprende. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.fr.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.fr.xlf index 7f7062817c..1a7c82dae2 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.fr.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Générateur de rapports Azure DevOps pour écrire les erreurs dans la sortie d’une manière comprise par Azure DevOps. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.it.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.it.xlf index 94a587b91b..4716e93ad7 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.it.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Il generatore di report di Azure DevOps per scrivere gli errori nell'output in un modo che Azure DevOps comprenda. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ja.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ja.xlf index 5b4d4cd73f..4b83fb99a4 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ja.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. AzureDev Ops が理解する方法で出力にエラーを書き込む Azure DevOps レポート生成プログラム。 diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ko.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ko.xlf index 5c4df0d2a3..8147c839c7 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ko.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Azure DevOps가 이해할 수 있는 방식으로 출력에 오류를 기록하는 Azure DevOps 보고서 생성기입니다. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pl.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pl.xlf index fc7d5baf9b..ed228d3024 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pl.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Generator raportów usługi Azure DevOps umożliwiający zapisywanie błędów w danych wyjściowych w sposób zrozumiały dla usługi Azure DevOps. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pt-BR.xlf index c303925d25..1273d6f5a5 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.pt-BR.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Gerador de relatórios do Azure DevOps para gravar erros na saída de uma forma que o Azure DevOps entenda. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ru.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ru.xlf index 1f0750cc33..92428cdbd7 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.ru.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Генератор отчетов Azure DevOps для записи ошибок в выходные данные в формате, который понимает Azure DevOps. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.tr.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.tr.xlf index d651ff29f3..b0ff7457b0 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.tr.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Hataları Azure DevOps'un anlayacağı şekilde çıktıya yazan Azure DevOps rapor oluşturucusu. diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hans.xlf index 51ad827a0c..b0d540a61c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hans.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Azure DevOps报表生成器,可通过 Azure DevOps 可理解的方式将错误写入输出。 diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hant.xlf index e4b76aa6a1..7a2e51155f 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Resources/xlf/AzureDevOpsResources.zh-Hant.xlf @@ -2,6 +2,11 @@ + + '--report-azdo-severity' requires '--report-azdo' to be enabled + '--report-azdo-severity' requires '--report-azdo' to be enabled + + Azure DevOps report generator to write errors to the output in a way that AzureDev Ops understands. Azure DevOps 報告產生器以 Azure DevOps 可理解的方式將錯誤寫入輸出。