From fa259c4c2b193b0d8937b26dab7fbfb0ccba1c97 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 17:02:39 +0000 Subject: [PATCH 1/7] Initial plan From b904e02b5f5708a311595c3a30126ae63a99179c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 17:23:32 +0000 Subject: [PATCH 2/7] Add crash report support to crash dump extension Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../CrashDumpCommandLineOptions.cs | 2 + .../CrashDumpCommandLineProvider.cs | 25 +++++-- .../CrashDumpEnvironmentVariableProvider.cs | 73 +++++++++++++++++-- .../CrashDumpProcessLifetimeHandler.cs | 50 ++++++++++--- .../PACKAGE.md | 4 +- .../Resources/CrashDumpResources.resx | 27 +++++++ .../Resources/xlf/CrashDumpResources.cs.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.de.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.es.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.fr.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.it.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.ja.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.ko.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.pl.xlf | 45 ++++++++++++ .../xlf/CrashDumpResources.pt-BR.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.ru.xlf | 45 ++++++++++++ .../Resources/xlf/CrashDumpResources.tr.xlf | 45 ++++++++++++ .../xlf/CrashDumpResources.zh-Hans.xlf | 45 ++++++++++++ .../xlf/CrashDumpResources.zh-Hant.xlf | 45 ++++++++++++ .../CrashDumpTests.cs | 34 +++++++++ .../HelpInfoAllExtensionsTests.cs | 12 +++ .../CrashDumpTests.cs | 60 ++++++++++++++- 22 files changed, 847 insertions(+), 25 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs index cb003f5027..da7a6bebbc 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs @@ -10,6 +10,8 @@ namespace Microsoft.Testing.Extensions.Diagnostics; internal static class CrashDumpCommandLineOptions { public const string CrashDumpOptionName = "crashdump"; + public const string CrashReportOptionName = "crashreport"; + public const string CrashReportOnlyOptionName = "crashreport-only"; public const string CrashDumpFileNameOptionName = "crashdump-filename"; public const string CrashDumpTypeOptionName = "crashdump-type"; } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs index fd028c6edc..2778102e8e 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs @@ -11,6 +11,14 @@ namespace Microsoft.Testing.Extensions.Diagnostics; internal sealed class CrashDumpCommandLineProvider : ICommandLineOptionsProvider { private static readonly string[] DumpTypeOptions = ["Mini", "Heap", "Triage", "Full"]; + private static readonly IReadOnlyCollection CachedCommandLineOptions = + [ + new(CrashDumpCommandLineOptions.CrashDumpOptionName, CrashDumpResources.CrashDumpOptionDescription, ArgumentArity.Zero, false), + new(CrashDumpCommandLineOptions.CrashReportOptionName, CrashDumpResources.CrashReportOptionDescription, ArgumentArity.Zero, false), + new(CrashDumpCommandLineOptions.CrashReportOnlyOptionName, CrashDumpResources.CrashReportOnlyOptionDescription, ArgumentArity.Zero, false), + new(CrashDumpCommandLineOptions.CrashDumpFileNameOptionName, CrashDumpResources.CrashDumpFileNameOptionDescription, ArgumentArity.ExactlyOne, false), + new(CrashDumpCommandLineOptions.CrashDumpTypeOptionName, CrashDumpResources.CrashDumpTypeOptionDescription, ArgumentArity.ExactlyOne, false) + ]; public string Uid => nameof(CrashDumpCommandLineProvider); @@ -22,13 +30,7 @@ internal sealed class CrashDumpCommandLineProvider : ICommandLineOptionsProvider public Task IsEnabledAsync() => Task.FromResult(true); - public IReadOnlyCollection GetCommandLineOptions() - => - [ - new CommandLineOption(CrashDumpCommandLineOptions.CrashDumpOptionName, CrashDumpResources.CrashDumpOptionDescription, ArgumentArity.Zero, false), - new CommandLineOption(CrashDumpCommandLineOptions.CrashDumpFileNameOptionName, CrashDumpResources.CrashDumpFileNameOptionDescription, ArgumentArity.ExactlyOne, false), - new CommandLineOption(CrashDumpCommandLineOptions.CrashDumpTypeOptionName, CrashDumpResources.CrashDumpTypeOptionDescription, ArgumentArity.ExactlyOne, false) - ]; + public IReadOnlyCollection GetCommandLineOptions() => CachedCommandLineOptions; public Task ValidateOptionArgumentsAsync(CommandLineOption commandOption, string[] arguments) { @@ -45,5 +47,12 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com } public Task ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions) - => ValidationResult.ValidTask; + => commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) && + !commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) + ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage) + : commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName) && + (commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || + commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) + ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage) + : ValidationResult.ValidTask; } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs index c3b5ed2c8f..ecfc56ce81 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs @@ -18,6 +18,8 @@ internal sealed class CrashDumpEnvironmentVariableProvider : ITestHostEnvironmen private const string MiniDumpNameVariable = "DbgMiniDumpName"; private const string CreateDumpDiagnosticsVariable = "CreateDumpDiagnostics"; private const string CreateDumpVerboseDiagnosticsVariable = "CreateDumpVerboseDiagnostics"; + private const string EnableCrashReportVariable = "EnableCrashReport"; + private const string EnableCrashReportOnlyVariable = "EnableCrashReportOnly"; private const string EnableMiniDumpValue = "1"; private static readonly string[] Prefixes = ["DOTNET_", "COMPlus_"]; @@ -54,17 +56,48 @@ public CrashDumpEnvironmentVariableProvider( /// public Task IsEnabledAsync() - => Task.FromResult(_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) && _crashDumpGeneratorConfiguration.Enable); + => Task.FromResult( + (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) && + _crashDumpGeneratorConfiguration.Enable); public Task UpdateAsync(IEnvironmentVariables environmentVariables) { + bool crashDumpEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); + bool crashReportEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); + bool crashReportOnlyEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); + + if (crashDumpEnabled || crashReportOnlyEnabled) + { + foreach (string prefix in Prefixes) + { + environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, false, true)); + } + } + foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, false, true)); environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, false, true)); environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, false, true)); } + if (crashReportEnabled) + { + foreach (string prefix in Prefixes) + { + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, false, true)); + } + } + + if (crashReportOnlyEnabled) + { + foreach (string prefix in Prefixes) + { + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, false, true)); + } + } + string miniDumpTypeValue = "4"; if (_commandLineOptions.TryGetOptionArgumentList(CrashDumpCommandLineOptions.CrashDumpTypeOptionName, out string[]? dumpTypeString)) @@ -133,12 +166,16 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl return ValidationResult.InvalidTask(CrashDumpResources.CrashDumpNotSupportedInNonNetCoreErrorMessage); #else StringBuilder errors = new(); - foreach (string prefix in Prefixes) + if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) { - if (!environmentVariables.TryGetVariable($"{prefix}{EnableMiniDumpVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + foreach (string prefix in Prefixes) { - AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + if (!environmentVariables.TryGetVariable($"{prefix}{EnableMiniDumpVariable}", out OwnedEnvironmentVariable? enableMiniDump) + || enableMiniDump.Value != EnableMiniDumpValue) + { + AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + } } } @@ -160,6 +197,30 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl } } + if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) + { + foreach (string prefix in Prefixes) + { + if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportVariable}", out OwnedEnvironmentVariable? enableCrashReport) + || enableCrashReport.Value != EnableMiniDumpValue) + { + AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, enableCrashReport?.Value); + } + } + } + + if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) + { + foreach (string prefix in Prefixes) + { + if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportOnlyVariable}", out OwnedEnvironmentVariable? enableCrashReportOnly) + || enableCrashReportOnly.Value != EnableMiniDumpValue) + { + AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, enableCrashReportOnly?.Value); + } + } + } + foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{MiniDumpTypeVariable}", out OwnedEnvironmentVariable? miniDumpType)) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs index dce2b1b5da..13dfee21c7 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs @@ -46,8 +46,11 @@ public CrashDumpProcessLifetimeHandler( public Type[] DataTypesProduced => [typeof(FileArtifact)]; public Task IsEnabledAsync() - => Task.FromResult(_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) - && _netCoreCrashDumpGeneratorConfiguration.Enable); + => Task.FromResult( + (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) && + _netCoreCrashDumpGeneratorConfiguration.Enable); public Task BeforeTestHostProcessStartAsync(CancellationToken _) => Task.CompletedTask; @@ -63,22 +66,51 @@ public async Task OnTestHostProcessExitedAsync(ITestHostProcessInformation testH } ApplicationStateGuard.Ensure(_netCoreCrashDumpGeneratorConfiguration.DumpFileNamePattern is not null); - await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CrashDumpProcessCrashedDumpFileCreated, testHostProcessInformation.PID)), cancellationToken).ConfigureAwait(false); + bool generateDump = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); + bool generateCrashReport = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); + + string processCrashedMessage = generateDump && generateCrashReport + ? string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CrashDumpProcessCrashedDumpAndReportFileCreated, testHostProcessInformation.PID) + : generateCrashReport + ? string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CrashDumpProcessCrashedReportFileCreated, testHostProcessInformation.PID) + : string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CrashDumpProcessCrashedDumpFileCreated, testHostProcessInformation.PID); + await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(processCrashedMessage), cancellationToken).ConfigureAwait(false); // TODO: Crash dump supports more placeholders that we don't handle here. // See "Dump name formatting" in: // https://github.com/dotnet/runtime/blob/82742628310076fff22d7e7ee216a74384352056/docs/design/coreclr/botr/xplat-minidump-generation.md string expectedDumpFile = _netCoreCrashDumpGeneratorConfiguration.DumpFileNamePattern.Replace("%p", testHostProcessInformation.PID.ToString(CultureInfo.InvariantCulture)); - if (File.Exists(expectedDumpFile)) + if (generateDump) { - await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(expectedDumpFile), CrashDumpResources.CrashDumpArtifactDisplayName, CrashDumpResources.CrashDumpArtifactDescription)).ConfigureAwait(false); + if (File.Exists(expectedDumpFile)) + { + await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(expectedDumpFile), CrashDumpResources.CrashDumpArtifactDisplayName, CrashDumpResources.CrashDumpArtifactDescription)).ConfigureAwait(false); + } + else + { + await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CannotFindExpectedCrashDumpFile, expectedDumpFile)), cancellationToken).ConfigureAwait(false); + foreach (string dumpFile in Directory.GetFiles(Path.GetDirectoryName(expectedDumpFile)!, "*.dmp")) + { + await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(dumpFile), CrashDumpResources.CrashDumpDisplayName, CrashDumpResources.CrashDumpArtifactDescription)).ConfigureAwait(false); + } + } } - else + + if (generateCrashReport) { - await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CannotFindExpectedCrashDumpFile, expectedDumpFile)), cancellationToken).ConfigureAwait(false); - foreach (string dumpFile in Directory.GetFiles(Path.GetDirectoryName(expectedDumpFile)!, "*.dmp")) + string expectedCrashReportFile = $"{expectedDumpFile}.crashreport.json"; + if (File.Exists(expectedCrashReportFile)) + { + await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(expectedCrashReportFile), CrashDumpResources.CrashReportArtifactDisplayName, CrashDumpResources.CrashReportArtifactDescription)).ConfigureAwait(false); + } + else { - await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(dumpFile), CrashDumpResources.CrashDumpDisplayName, CrashDumpResources.CrashDumpArtifactDescription)).ConfigureAwait(false); + await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CannotFindExpectedCrashReportFile, expectedCrashReportFile)), cancellationToken).ConfigureAwait(false); + foreach (string crashReportFile in Directory.GetFiles(Path.GetDirectoryName(expectedCrashReportFile)!, "*.crashreport.json")) + { + await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(crashReportFile), CrashDumpResources.CrashReportArtifactDisplayName, CrashDumpResources.CrashReportArtifactDescription)).ConfigureAwait(false); + } } } } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md b/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md index 6edac3ba07..9d34f5a7d7 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md @@ -1,6 +1,6 @@ # Microsoft.Testing.Extensions.CrashDump -Microsoft.Testing.Extensions.CrashDump is an extension for [Microsoft.Testing.Platform](https://www.nuget.org/packages/Microsoft.Testing.Platform) that captures a crash dump of the test host process when an unhandled exception or crash occurs. +Microsoft.Testing.Extensions.CrashDump is an extension for [Microsoft.Testing.Platform](https://www.nuget.org/packages/Microsoft.Testing.Platform) that captures a crash dump or crash report for the test host process when an unhandled exception or crash occurs. Microsoft.Testing.Platform is open source. You can find `Microsoft.Testing.Extensions.CrashDump` code in the [microsoft/testfx](https://github.com/microsoft/testfx) GitHub repository. @@ -15,11 +15,13 @@ dotnet add package Microsoft.Testing.Extensions.CrashDump This package extends Microsoft.Testing.Platform with: - **Crash dump collection**: automatically captures a memory dump when the test process crashes +- **Crash report collection**: optionally emits a lightweight JSON crash report to help diagnose crashes without uploading a full dump - **Post-mortem debugging**: collected dumps can be analyzed with tools like Visual Studio, WinDbg, or `dotnet-dump` - **Cross-platform**: supported on Windows, Linux, and macOS. Note that dumps collected on macOS can only be analyzed on macOS - **Runtime behavior**: supported for .NET 6+; on .NET Framework this extension is ignored Enable crash dump collection via the `--crashdump` command line option. +Add `--crashreport` to generate a dump and crash report together, or use `--crashreport-only` to generate only the crash report. ## Related packages diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx index 86e83bf522..28b6da6b47 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx @@ -120,6 +120,9 @@ Expected crash dump file '{0}' could not be found, all files matching the '*.dmp' pattern will be copied to the result folder + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + The testhost process crash dump file @@ -144,9 +147,33 @@ [net6.0+ only] Generate a dump file if the test process crashes + + The testhost process crash report file + + + Crash report file + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + [net7.0+ only] Generate only a crash report file if the test process crashes + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file was generated + + Test host process with PID '{0}' crashed, a crash report was generated + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf index 4874a45bfb..5cfe2cf444 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf @@ -7,6 +7,11 @@ Nebyl nalezen očekávaný soubor výpisu stavu systému {0}. Všechny soubory odpovídající vzoru *.dmp budou zkopírovány do složky výsledků. + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Soubor výpisu stavu systému procesu testhost @@ -47,11 +52,21 @@ [Pouze net6.0+ ] Vygenerovat soubor výpisu paměti v případě chybového ukončení procesu testu + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Hostitelský proces testu s identifikátorem PID {0} byl chybově ukončen. Byl vygenerován soubor výpisu paměti. + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Další informace najdete na https://learn.microsoft.com/dotnet/core/diagnostics --hangdump-type očekává jako argument jeden typ výpisu paměti (například --hangdump-type Heap). + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Žádosti typu {0} nejsou podporovány. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf index 12d9a235f0..f7c9a94de0 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf @@ -7,6 +7,11 @@ Die erwartete Absturzabbilddatei "{0}" wurde nicht gefunden. Alle Dateien, die dem Muster "*.dmp" entsprechen, werden in den Ergebnisordner kopiert + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Die Absturzabbilddatei für den Testhostprozess @@ -47,11 +52,21 @@ [nur net6.0+] Speicherabbilddatei generieren, wenn der Testprozess abstürzt + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Der Testhostprozess mit PID "{0}" ist abgestürzt. Es wurde eine Abbilddatei generiert + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Weitere Informationen finden Sie unter https://learn.microsoft.com/dotnet/core/d "--crashdump-type" erwartet einen einzelnen Speicherabbildtyp als Argument (z. B. "--crashdump-type Heap") + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Anforderungen vom Typ "{0}" werden nicht unterstützt diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf index 2d53d62722..419877a33e 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf @@ -7,6 +7,11 @@ No se encontró el '{0}' de archivo de volcado esperado. Todos los archivos que coincidan con el patrón "*.dmp" se copiarán en la carpeta de resultados. + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Archivo de volcado de memoria del proceso del host de pruebas @@ -47,11 +52,21 @@ [solo net6.0+ ] Generar un archivo de volcado si el proceso de prueba se bloquea + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Se bloqueó el proceso de host de prueba con PID '{0}' y se generó un archivo de volcado + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Para obtener más información, visite https://learn.microsoft.com/dotnet/core/d '--crashdump-type' espera un único tipo de volcado como argumento (por ejemplo, '--crashdump-type Heap') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported No se admiten solicitudes de tipo '{0}' diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf index af3adfcfbc..cea7dac669 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf @@ -7,6 +7,11 @@ Le fichier de vidage sur incident attendu « {0} » n'a pas été trouvé, tous les fichiers correspondant au modèle « *.dmp » seront copiés dans le dossier de résultats. + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Le fichier de vidage sur incident du processus testhost @@ -47,11 +52,21 @@ [net6.0+ uniquement] Générer un fichier de vidage si le processus de test se bloque + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Le processus hôte de test avec le PID «{0}» s’est arrêté, un fichier de vidage a été généré + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Pour plus d’informations, visitez https://learn.microsoft.com/dotnet/core/diag '--crashdump-type' attend un seul type de dump comme argument (par exemple '--crashdump-type Heap') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Les demandes de type «{0}» ne sont pas prises en charge diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf index e9af7b3ed6..64175470d2 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf @@ -7,6 +7,11 @@ Il file di dump di arresto anomalo '{0}' previsto non è stato trovato. Tutti i file corrispondenti al criterio '*.dmp' verranno copiati nella cartella dei risultati. + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file File di dump di arresto anomalo del processo testhost @@ -47,11 +52,21 @@ [solo net6.0+ ] Generazione di un file di dump in caso di arresto anomalo del processo di test + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Il processo host di test con PID '{0}' si è arrestato in modo anomalo. È stato generato un file di dump + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Per altre informazioni, visitare https://learn.microsoft.com/dotnet/core/diagnos '--crashdump-type' prevede un singolo tipo di dump come argomento (ad esempio '--crashdump-type Heap') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Le richieste di tipo '{0}' non sono supportate diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf index 4e9828351c..02b8376ca9 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf @@ -7,6 +7,11 @@ 予期されたクラッシュ ダンプ ファイル '{0}' が見つかりませんでした。'*.dmp' パターンに一致するすべてのファイルが結果フォルダーにコピーされます + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file testhost プロセスのクラッシュ ダンプ ファイル @@ -47,11 +52,21 @@ [net6.0+ のみ] テスト プロセスがクラッシュした場合にダンプ ファイルを生成する + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated PID '{0}' のテスト ホスト プロセスがクラッシュしました。ダンプ ファイルが生成されました + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c '--crashdump-type' には、引数として 1 つのダンプの型が必要です (例: '--crashdump-type Heap') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported 型 '{0}' の要求はサポートされていません diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf index 4f3ee10358..21bdc4b5d4 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf @@ -7,6 +7,11 @@ 필요한 크래시 덤프 파일 '{0}'을(를) 찾을 수 없습니다. '*.dmp' 패턴과 일치하는 모든 파일이 결과 폴더에 복사됩니다. + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file testhost 프로세스 크래시 덤프 파일 @@ -47,11 +52,21 @@ [net6.0 이상만] 테스트 프로세스가 충돌하는 경우 덤프 파일 생성 + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated PID가 '{0}'인 테스트 호스트 프로세스가 충돌했습니다. 덤프 파일이 생성되었습니다. + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c '--crashdump-type'에는 단일 덤프 유형이 인수로 필요합니다(예: '--crashdump-type Heap'). + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported '{0}' 유형의 요청은 지원되지 않습니다. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf index ff360e4442..116d061cc2 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf @@ -7,6 +7,11 @@ Nie można odnaleźć oczekiwanego pliku zrzutu awaryjnego „{0}”. Wszystkie pliki zgodne ze wzorcem „*.dmp” zostaną skopiowane do folderu wyników + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Plik zrzutu awaryjnego procesu testhost @@ -47,11 +52,21 @@ [tylko net6.0+ ] Wygeneruj plik zrzutu w przypadku awarii procesu testowego + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Proces hosta testowego o identyfikatorze PID „{0}{0}” uległ awarii, wygenerowano plik zrzutu + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Aby uzyskać więcej informacji, odwiedź stronę https://learn.microsoft.com/do Element „--crashdump-type” oczekuje pojedynczego typu zrzutu jako argumentu (np. „--crashdump-type Heap”) + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Żądania typu „{0}” nie są obsługiwane diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf index 30bf9ddd72..9c6a5b5d8b 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf @@ -7,6 +7,11 @@ O arquivo de despejo de memória ''{0}'' não pôde ser encontrado. Todos os arquivos correspondentes ao padrão ''*.dmp'' serão copiados para a pasta de resultados + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file O arquivo de despejo de memória do processo testhost @@ -47,11 +52,21 @@ [somente net6.0+] Gerar um arquivo de despejo se o processo de teste falhar + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated O processo de host de teste com PID ''{0}'' falhou e um arquivo de despejo foi gerado + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Para obter mais informações, visite https://learn.microsoft.com/dotnet/core/di ''--crashdump-type'' espera um único tipo de despejo como argumento (por exemplo, ''--crashdump-type Heap'') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Não há suporte para solicitações de tipo ''{0}'' diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf index f88ad320fe..12b20d9441 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf @@ -7,6 +7,11 @@ Не удалось найти ожидаемый файл аварийного дампа "{0}". Все файлы, соответствующие шаблону "*.dmp", будут скопированы в папку результатов. + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Файл аварийного дампа тестового хост-процесса @@ -47,11 +52,21 @@ [только net6.0 и выше] Создавать файл дампа в случае сбоя тестового процесса + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated Произошло аварийное завершение тестового хост-процесса с идентификатором процесса "{0}". Создан файл дампа + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c "--hangdump-type" ожидает в качестве аргумента один тип дампа (например, "--crashdump-type Heap") + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported Запросы типа "{0}" не поддерживаются diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf index 1a67584b25..84e0f1b421 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf @@ -7,6 +7,11 @@ Beklenen kilitlenme dökümü dosyası '{0}' bulunamadı, '*.dmp' düzeniyle eşleşen tüm dosyalar sonuç klasörüne kopyalanacak + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file Test ana bilgisayarı işlemi kilitlenme bilgi dökümü dosyası @@ -47,11 +52,21 @@ [yalnızca net6.0+] Test işlemi çökerse bir döküm dosyası oluşturun + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated PID'li test ana işlemi ‘{0}' kilitlendi, bir döküm dosyası oluşturuldu + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ Daha fazla bilgi için https://learn.microsoft.com/dotnet/core/diagnostics/colle '--crashdump-type' argüman olarak tek bir döküm tipini bekler (örneğin, '--crashdump-type Heap') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported '{0}' türündeki istek desteklenmiyor diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf index 159e244e68..3e48000502 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf @@ -7,6 +7,11 @@ 找不到预期的故障转储文件“{0}”,与“*.dmp”模式匹配的所有文件都将复制到结果文件夹 + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file testhost 进程故障转储文件 @@ -47,11 +52,21 @@ [仅限 net6.0+]如果测试进程崩溃,则生成转储文件 + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated PID 为“{0}”的测试主机进程崩溃,生成了转储文件 + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c “--crashdump-type”需要将单一转储类型作为参数(例如“--crashdump-type Heap”) + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported 不支持类型为“{0}”的请求 diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf index 4edcf4cbc3..37e724192c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf @@ -7,6 +7,11 @@ 找不到預期的損毀傾印檔案 '{0}',符合 '*.dmp' 模式的所有檔案都將複製到結果資料夾 + + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + + The testhost process crash dump file testhost 處理常式損毀傾印檔案 @@ -47,11 +52,21 @@ [net6.0+ only] 如果測試流程損毀,則產生傾印檔案 + + Test host process with PID '{0}' crashed, a dump file and crash report were generated + Test host process with PID '{0}' crashed, a dump file and crash report were generated + + Test host process with PID '{0}' crashed, a dump file was generated PID '{0}' 損毀的測試主機處理常式,已產生傾印檔案 + + Test host process with PID '{0}' crashed, a crash report was generated + Test host process with PID '{0}' crashed, a crash report was generated + + Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. @@ -71,6 +86,36 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c '--crashdump-type' 需要單一傾印類型做為引數 (例如 '--crashdump-type Heap') + + The testhost process crash report file + The testhost process crash report file + + + + Crash report file + Crash report file + + + + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' + + + + [net7.0+ only] Generate only a crash report file if the test process crashes + [net7.0+ only] Generate only a crash report file if the test process crashes + + + + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + + + + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + + Requests of type '{0}' is not supported 不支援類型 '{0}' 的要求 diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index cf7e844be3..0d557e3878 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -44,6 +44,30 @@ public async Task CrashDump_Formats_CreateDump(string format) File.Delete(dumpFile); } + [TestMethod] + public async Task CrashDump_WithCrashReport_CreateDumpAndCrashReport() + { + string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); + var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); + TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashdump --crashreport --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); + testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); + + Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "CrashDump_*.dmp", SearchOption.AllDirectories), $"Dump file not found\n{testHostResult}"); + Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "CrashDump_*.dmp.crashreport.json", SearchOption.AllDirectories), $"Crash report file not found\n{testHostResult}"); + } + + [TestMethod] + public async Task CrashReportOnly_CustomDumpName_CreateOnlyCrashReport() + { + string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); + var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); + TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport-only --crashdump-filename customdumpname.dmp --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); + testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); + + Assert.IsEmpty(Directory.GetFiles(resultDirectory, "customdumpname.dmp", SearchOption.AllDirectories), $"Unexpected dump file found\n{testHostResult}"); + Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "customdumpname.dmp.crashreport.json", SearchOption.AllDirectories), $"Crash report file not found\n{testHostResult}"); + } + [TestMethod] public async Task CrashDump_InvalidFormat_ShouldFail() { @@ -54,6 +78,16 @@ public async Task CrashDump_InvalidFormat_ShouldFail() testHostResult.AssertOutputContains("Option '--crashdump-type' has invalid arguments: 'invalid' is not a valid dump type. Valid options are 'Mini', 'Heap', 'Triage' and 'Full'"); } + [TestMethod] + public async Task CrashReport_Without_CrashDump_ShouldFail() + { + string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); + var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); + TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); + testHostResult.AssertExitCodeIs(ExitCode.InvalidCommandLine); + testHostResult.AssertOutputContains("You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line"); + } + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "CrashDumpFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index 5151f2f827..757c4fa17d 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -70,6 +70,10 @@ Takes one argument as string in the format [h|m|s] where 'value' is float Extension options: --crashdump [net6.0+ only] Generate a dump file if the test process crashes + --crashreport + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + --crashreport-only + [net7.0+ only] Generate only a crash report file if the test process crashes --crashdump-filename Specify the name of the dump file --crashdump-type @@ -270,6 +274,14 @@ Takes one argument as string in the format [h|m|s] where 'value' is float Arity: 0 Hidden: False Description: [net6.0+ only] Generate a dump file if the test process crashes + --crashreport + Arity: 0 + Hidden: False + Description: [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + --crashreport-only + Arity: 0 + Hidden: False + Description: [net7.0+ only] Generate only a crash report file if the test process crashes --crashdump-filename Arity: 1 Hidden: False diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs index 4f2b1640f2..b3a834c1e7 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs @@ -38,7 +38,7 @@ public async Task IsInvValid_If_CrashDumpType_Has_IncorrectValue() } [TestMethod] - public async Task CrashDump_CommandLineOptions_Are_AlwaysValid() + public async Task CrashDump_CommandLineOptions_Are_Valid_ByDefault() { var provider = new CrashDumpCommandLineProvider(); @@ -46,4 +46,62 @@ public async Task CrashDump_CommandLineOptions_Are_AlwaysValid() Assert.IsTrue(validateOptionsResult.IsValid); Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); } + + [TestMethod] + public async Task CrashReport_Without_CrashDump_Is_Invalid() + { + var provider = new CrashDumpCommandLineProvider(); + var options = new Dictionary + { + { CrashDumpCommandLineOptions.CrashReportOptionName, [] }, + }; + + ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); + Assert.IsFalse(validateOptionsResult.IsValid); + Assert.AreEqual(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage, validateOptionsResult.ErrorMessage); + } + + [TestMethod] + public async Task CrashReport_Alongside_CrashDump_Is_Valid() + { + var provider = new CrashDumpCommandLineProvider(); + var options = new Dictionary + { + { CrashDumpCommandLineOptions.CrashDumpOptionName, [] }, + { CrashDumpCommandLineOptions.CrashReportOptionName, [] }, + }; + + ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); + Assert.IsTrue(validateOptionsResult.IsValid); + Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); + } + + [TestMethod] + public async Task CrashReportOnly_Cannot_Be_Combined_With_Other_Crash_Options() + { + var provider = new CrashDumpCommandLineProvider(); + var options = new Dictionary + { + { CrashDumpCommandLineOptions.CrashDumpOptionName, [] }, + { CrashDumpCommandLineOptions.CrashReportOnlyOptionName, [] }, + }; + + ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); + Assert.IsFalse(validateOptionsResult.IsValid); + Assert.AreEqual(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage, validateOptionsResult.ErrorMessage); + } + + [TestMethod] + public async Task CrashReportOnly_Alone_Is_Valid() + { + var provider = new CrashDumpCommandLineProvider(); + var options = new Dictionary + { + { CrashDumpCommandLineOptions.CrashReportOnlyOptionName, [] }, + }; + + ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); + Assert.IsTrue(validateOptionsResult.IsValid); + Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); + } } From 142367b2346dd755175504aa15f0344d1921454d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 14 May 2026 20:19:16 +0200 Subject: [PATCH 3/7] Fix CLI option ordering in HelpInfoAllExtensionsTests and tighten CrashDump tests/code - Reorder --crashreport / --crashreport-only after --crashdump-type in the Help and Info expectations to match the platform's alphabetical ordering (CommandLineHandler.PrintOptionsAsync OrderBy(option.Name)). - Refactor CrashDump option validation into explicit if-statements for clarity. - Rename EnableMiniDumpValue -> EnabledValue (now reused for crash report vars). - Make CrashReportOnly_CustomDumpName_CreateOnlyCrashReport robust on Windows by doing an exact filename comparison instead of relying on Directory.GetFiles pattern matching, which can match 'customdumpname.dmp.crashreport.json'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CrashDumpCommandLineProvider.cs | 26 ++++++++++----- .../CrashDumpEnvironmentVariableProvider.cs | 32 +++++++++---------- .../CrashDumpTests.cs | 7 +++- .../HelpInfoAllExtensionsTests.cs | 24 +++++++------- 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs index 2778102e8e..5ac651047d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs @@ -47,12 +47,22 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com } public Task ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions) - => commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) && - !commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) - ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage) - : commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName) && - (commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || - commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) - ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage) - : ValidationResult.ValidTask; + { + bool isCrashDumpSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); + bool isCrashReportSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); + bool isCrashReportOnlySet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); + + if (isCrashReportSet && !isCrashDumpSet) + { + return ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage); + } + + if (isCrashReportOnlySet && (isCrashDumpSet || isCrashReportSet)) + { + return ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage); + } + + // No problem found + return ValidationResult.ValidTask; + } } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs index ecfc56ce81..90edb6e1e1 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs @@ -20,7 +20,7 @@ internal sealed class CrashDumpEnvironmentVariableProvider : ITestHostEnvironmen private const string CreateDumpVerboseDiagnosticsVariable = "CreateDumpVerboseDiagnostics"; private const string EnableCrashReportVariable = "EnableCrashReport"; private const string EnableCrashReportOnlyVariable = "EnableCrashReportOnly"; - private const string EnableMiniDumpValue = "1"; + private const string EnabledValue = "1"; private static readonly string[] Prefixes = ["DOTNET_", "COMPlus_"]; private readonly IConfiguration _configuration; @@ -72,21 +72,21 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnabledValue, false, true)); } } foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, false, true)); - environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, false, true)); } if (crashReportEnabled) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnabledValue, false, true)); } } @@ -94,7 +94,7 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, false, true)); } } @@ -172,9 +172,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableMiniDumpVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + || enableMiniDump.Value != EnabledValue) { - AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnabledValue, enableMiniDump?.Value); } } } @@ -182,18 +182,18 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + || enableMiniDump.Value != EnabledValue) { - AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); } } foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + || enableMiniDump.Value != EnabledValue) { - AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); } } @@ -202,9 +202,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportVariable}", out OwnedEnvironmentVariable? enableCrashReport) - || enableCrashReport.Value != EnableMiniDumpValue) + || enableCrashReport.Value != EnabledValue) { - AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, enableCrashReport?.Value); + AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnabledValue, enableCrashReport?.Value); } } } @@ -214,9 +214,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportOnlyVariable}", out OwnedEnvironmentVariable? enableCrashReportOnly) - || enableCrashReportOnly.Value != EnableMiniDumpValue) + || enableCrashReportOnly.Value != EnabledValue) { - AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, enableCrashReportOnly?.Value); + AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, enableCrashReportOnly?.Value); } } } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 0d557e3878..29aa995b48 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -64,7 +64,12 @@ public async Task CrashReportOnly_CustomDumpName_CreateOnlyCrashReport() TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport-only --crashdump-filename customdumpname.dmp --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); - Assert.IsEmpty(Directory.GetFiles(resultDirectory, "customdumpname.dmp", SearchOption.AllDirectories), $"Unexpected dump file found\n{testHostResult}"); + // Use an explicit equality check on the file name rather than relying on Directory.GetFiles' pattern matching, + // because on Windows a literal pattern such as "customdumpname.dmp" can also match files like + // "customdumpname.dmp.crashreport.json" (8.3 short-name aliases / extension prefix matching). + string[] dumpFiles = [.. Directory.EnumerateFiles(resultDirectory, "*", SearchOption.AllDirectories) + .Where(f => string.Equals(Path.GetFileName(f), "customdumpname.dmp", StringComparison.Ordinal))]; + Assert.IsEmpty(dumpFiles, $"Unexpected dump file found\n{testHostResult}"); Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "customdumpname.dmp.crashreport.json", SearchOption.AllDirectories), $"Crash report file not found\n{testHostResult}"); } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index 757c4fa17d..168ba96d85 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -70,16 +70,16 @@ Takes one argument as string in the format [h|m|s] where 'value' is float Extension options: --crashdump [net6.0+ only] Generate a dump file if the test process crashes - --crashreport - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - --crashreport-only - [net7.0+ only] Generate only a crash report file if the test process crashes --crashdump-filename Specify the name of the dump file --crashdump-type Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/collect-dumps-crash#types-of-mini-dumps + --crashreport + [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + --crashreport-only + [net7.0+ only] Generate only a crash report file if the test process crashes --hangdump Generate a dump file if the test process hangs --hangdump-filename @@ -274,14 +274,6 @@ Takes one argument as string in the format [h|m|s] where 'value' is float Arity: 0 Hidden: False Description: [net6.0+ only] Generate a dump file if the test process crashes - --crashreport - Arity: 0 - Hidden: False - Description: [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - --crashreport-only - Arity: 0 - Hidden: False - Description: [net7.0+ only] Generate only a crash report file if the test process crashes --crashdump-filename Arity: 1 Hidden: False @@ -292,6 +284,14 @@ Takes one argument as string in the format [h|m|s] where 'value' is float Description: Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/collect-dumps-crash#types-of-mini-dumps + --crashreport + Arity: 0 + Hidden: False + Description: [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. + --crashreport-only + Arity: 0 + Hidden: False + Description: [net7.0+ only] Generate only a crash report file if the test process crashes HangDumpCommandLineProvider Name: Hang dump Version: * From a8755ada7356b61e9aa21ae1dad3eecb596869ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 14 May 2026 20:29:53 +0200 Subject: [PATCH 4/7] Revert auxiliary CrashDump refactoring Revert the validation refactor, EnabledValue rename, and the Windows-safe filename check in CrashReportOnly_CustomDumpName_CreateOnlyCrashReport. The HelpInfoAllExtensionsTests ordering fix is preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CrashDumpCommandLineProvider.cs | 26 +++++---------- .../CrashDumpEnvironmentVariableProvider.cs | 32 +++++++++---------- .../CrashDumpTests.cs | 7 +--- 3 files changed, 25 insertions(+), 40 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs index 5ac651047d..2778102e8e 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs @@ -47,22 +47,12 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com } public Task ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions) - { - bool isCrashDumpSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); - bool isCrashReportSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); - bool isCrashReportOnlySet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); - - if (isCrashReportSet && !isCrashDumpSet) - { - return ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage); - } - - if (isCrashReportOnlySet && (isCrashDumpSet || isCrashReportSet)) - { - return ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage); - } - - // No problem found - return ValidationResult.ValidTask; - } + => commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) && + !commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) + ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage) + : commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName) && + (commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || + commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) + ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage) + : ValidationResult.ValidTask; } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs index 90edb6e1e1..ecfc56ce81 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs @@ -20,7 +20,7 @@ internal sealed class CrashDumpEnvironmentVariableProvider : ITestHostEnvironmen private const string CreateDumpVerboseDiagnosticsVariable = "CreateDumpVerboseDiagnostics"; private const string EnableCrashReportVariable = "EnableCrashReport"; private const string EnableCrashReportOnlyVariable = "EnableCrashReportOnly"; - private const string EnabledValue = "1"; + private const string EnableMiniDumpValue = "1"; private static readonly string[] Prefixes = ["DOTNET_", "COMPlus_"]; private readonly IConfiguration _configuration; @@ -72,21 +72,21 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, false, true)); } } foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, false, true)); - environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, false, true)); } if (crashReportEnabled) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, false, true)); } } @@ -94,7 +94,7 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, false, true)); } } @@ -172,9 +172,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableMiniDumpVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnabledValue) + || enableMiniDump.Value != EnableMiniDumpValue) { - AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnabledValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, enableMiniDump?.Value); } } } @@ -182,18 +182,18 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnabledValue) + || enableMiniDump.Value != EnableMiniDumpValue) { - AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, enableMiniDump?.Value); } } foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnabledValue) + || enableMiniDump.Value != EnableMiniDumpValue) { - AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, enableMiniDump?.Value); } } @@ -202,9 +202,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportVariable}", out OwnedEnvironmentVariable? enableCrashReport) - || enableCrashReport.Value != EnabledValue) + || enableCrashReport.Value != EnableMiniDumpValue) { - AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnabledValue, enableCrashReport?.Value); + AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, enableCrashReport?.Value); } } } @@ -214,9 +214,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportOnlyVariable}", out OwnedEnvironmentVariable? enableCrashReportOnly) - || enableCrashReportOnly.Value != EnabledValue) + || enableCrashReportOnly.Value != EnableMiniDumpValue) { - AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, enableCrashReportOnly?.Value); + AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, enableCrashReportOnly?.Value); } } } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 29aa995b48..0d557e3878 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -64,12 +64,7 @@ public async Task CrashReportOnly_CustomDumpName_CreateOnlyCrashReport() TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport-only --crashdump-filename customdumpname.dmp --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); - // Use an explicit equality check on the file name rather than relying on Directory.GetFiles' pattern matching, - // because on Windows a literal pattern such as "customdumpname.dmp" can also match files like - // "customdumpname.dmp.crashreport.json" (8.3 short-name aliases / extension prefix matching). - string[] dumpFiles = [.. Directory.EnumerateFiles(resultDirectory, "*", SearchOption.AllDirectories) - .Where(f => string.Equals(Path.GetFileName(f), "customdumpname.dmp", StringComparison.Ordinal))]; - Assert.IsEmpty(dumpFiles, $"Unexpected dump file found\n{testHostResult}"); + Assert.IsEmpty(Directory.GetFiles(resultDirectory, "customdumpname.dmp", SearchOption.AllDirectories), $"Unexpected dump file found\n{testHostResult}"); Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "customdumpname.dmp.crashreport.json", SearchOption.AllDirectories), $"Crash report file not found\n{testHostResult}"); } From e8b48188e30399399630c2ef53c9e235bd887824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 14 May 2026 20:51:07 +0200 Subject: [PATCH 5/7] Address PR review comments - CrashDumpCommandLineProvider: replace chained ternary with explicit if-statements for clarity and easier extension. - CrashDumpEnvironmentVariableProvider: rename EnableMiniDumpValue to EnabledValue since it's now reused for the crash report environment variables (DOTNET_EnableCrashReport / DOTNET_EnableCrashReportOnly). - CrashReportOnly_CustomDumpName_CreateOnlyCrashReport: do an explicit filename comparison instead of relying on Directory.GetFiles' pattern matching, which on Windows can also match 'customdumpname.dmp.crashreport.json' for the literal pattern 'customdumpname.dmp'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CrashDumpCommandLineProvider.cs | 26 +++++++++----- .../CrashDumpEnvironmentVariableProvider.cs | 34 +++++++++---------- .../CrashDumpTests.cs | 7 +++- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs index 2778102e8e..5ac651047d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs @@ -47,12 +47,22 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com } public Task ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions) - => commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) && - !commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) - ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage) - : commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName) && - (commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || - commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) - ? ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage) - : ValidationResult.ValidTask; + { + bool isCrashDumpSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); + bool isCrashReportSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); + bool isCrashReportOnlySet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); + + if (isCrashReportSet && !isCrashDumpSet) + { + return ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage); + } + + if (isCrashReportOnlySet && (isCrashDumpSet || isCrashReportSet)) + { + return ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage); + } + + // No problem found + return ValidationResult.ValidTask; + } } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs index ecfc56ce81..b2db3277f1 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.Testing.Extensions.Diagnostics.Resources; @@ -20,7 +20,7 @@ internal sealed class CrashDumpEnvironmentVariableProvider : ITestHostEnvironmen private const string CreateDumpVerboseDiagnosticsVariable = "CreateDumpVerboseDiagnostics"; private const string EnableCrashReportVariable = "EnableCrashReport"; private const string EnableCrashReportOnlyVariable = "EnableCrashReportOnly"; - private const string EnableMiniDumpValue = "1"; + private const string EnabledValue = "1"; private static readonly string[] Prefixes = ["DOTNET_", "COMPlus_"]; private readonly IConfiguration _configuration; @@ -72,21 +72,21 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableMiniDumpVariable}", EnabledValue, false, true)); } } foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, false, true)); - environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, false, true)); } if (crashReportEnabled) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnabledValue, false, true)); } } @@ -94,7 +94,7 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) { foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, false, true)); } } @@ -172,9 +172,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableMiniDumpVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + || enableMiniDump.Value != EnabledValue) { - AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnabledValue, enableMiniDump?.Value); } } } @@ -182,18 +182,18 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + || enableMiniDump.Value != EnabledValue) { - AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); } } foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnableMiniDumpValue) + || enableMiniDump.Value != EnabledValue) { - AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnableMiniDumpValue, enableMiniDump?.Value); + AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); } } @@ -202,9 +202,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportVariable}", out OwnedEnvironmentVariable? enableCrashReport) - || enableCrashReport.Value != EnableMiniDumpValue) + || enableCrashReport.Value != EnabledValue) { - AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnableMiniDumpValue, enableCrashReport?.Value); + AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnabledValue, enableCrashReport?.Value); } } } @@ -214,9 +214,9 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl foreach (string prefix in Prefixes) { if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportOnlyVariable}", out OwnedEnvironmentVariable? enableCrashReportOnly) - || enableCrashReportOnly.Value != EnableMiniDumpValue) + || enableCrashReportOnly.Value != EnabledValue) { - AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnableMiniDumpValue, enableCrashReportOnly?.Value); + AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, enableCrashReportOnly?.Value); } } } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 0d557e3878..29aa995b48 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -64,7 +64,12 @@ public async Task CrashReportOnly_CustomDumpName_CreateOnlyCrashReport() TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport-only --crashdump-filename customdumpname.dmp --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); - Assert.IsEmpty(Directory.GetFiles(resultDirectory, "customdumpname.dmp", SearchOption.AllDirectories), $"Unexpected dump file found\n{testHostResult}"); + // Use an explicit equality check on the file name rather than relying on Directory.GetFiles' pattern matching, + // because on Windows a literal pattern such as "customdumpname.dmp" can also match files like + // "customdumpname.dmp.crashreport.json" (8.3 short-name aliases / extension prefix matching). + string[] dumpFiles = [.. Directory.EnumerateFiles(resultDirectory, "*", SearchOption.AllDirectories) + .Where(f => string.Equals(Path.GetFileName(f), "customdumpname.dmp", StringComparison.Ordinal))]; + Assert.IsEmpty(dumpFiles, $"Unexpected dump file found\n{testHostResult}"); Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "customdumpname.dmp.crashreport.json", SearchOption.AllDirectories), $"Crash report file not found\n{testHostResult}"); } From d68feac1ca0788f83896ac85b9ee98cfa32a7bb9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 19:01:19 +0000 Subject: [PATCH 6/7] Address CrashDump review comments Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../CrashDumpCommandLineProvider.cs | 8 +-- .../CrashDumpEnvironmentVariableProvider.cs | 61 ++++++------------- .../CrashDumpProcessLifetimeHandler.cs | 9 ++- .../Resources/CrashDumpResources.resx | 4 +- .../Resources/xlf/CrashDumpResources.cs.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.de.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.es.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.fr.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.it.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.ja.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.ko.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.pl.xlf | 8 +-- .../xlf/CrashDumpResources.pt-BR.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.ru.xlf | 8 +-- .../Resources/xlf/CrashDumpResources.tr.xlf | 8 +-- .../xlf/CrashDumpResources.zh-Hans.xlf | 8 +-- .../xlf/CrashDumpResources.zh-Hant.xlf | 8 +-- .../CrashDumpTests.cs | 4 +- .../CrashDumpTests.cs | 6 +- 19 files changed, 89 insertions(+), 107 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs index 5ac651047d..0b82a33d73 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs @@ -52,14 +52,14 @@ public Task ValidateCommandLineOptionsAsync(ICommandLineOption bool isCrashReportSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); bool isCrashReportOnlySet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); - if (isCrashReportSet && !isCrashDumpSet) + if (isCrashReportOnlySet && (isCrashDumpSet || isCrashReportSet)) { - return ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage); + return ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage); } - if (isCrashReportOnlySet && (isCrashDumpSet || isCrashReportSet)) + if (isCrashReportSet && !isCrashDumpSet) { - return ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage); + return ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage); } // No problem found diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs index b2db3277f1..a190706052 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs @@ -68,7 +68,7 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) bool crashReportEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); bool crashReportOnlyEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); - if (crashDumpEnabled || crashReportOnlyEnabled) + if (crashDumpEnabled || crashReportEnabled || crashReportOnlyEnabled) { foreach (string prefix in Prefixes) { @@ -167,58 +167,23 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl #else StringBuilder errors = new(); if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) { - foreach (string prefix in Prefixes) - { - if (!environmentVariables.TryGetVariable($"{prefix}{EnableMiniDumpVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnabledValue) - { - AddError(errors, $"{prefix}{EnableMiniDumpVariable}", EnabledValue, enableMiniDump?.Value); - } - } + ValidateBothPrefixes(EnableMiniDumpVariable, EnabledValue); } - foreach (string prefix in Prefixes) - { - if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnabledValue) - { - AddError(errors, $"{prefix}{CreateDumpDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); - } - } - - foreach (string prefix in Prefixes) - { - if (!environmentVariables.TryGetVariable($"{prefix}{CreateDumpVerboseDiagnosticsVariable}", out OwnedEnvironmentVariable? enableMiniDump) - || enableMiniDump.Value != EnabledValue) - { - AddError(errors, $"{prefix}{CreateDumpVerboseDiagnosticsVariable}", EnabledValue, enableMiniDump?.Value); - } - } + ValidateBothPrefixes(CreateDumpDiagnosticsVariable, EnabledValue); + ValidateBothPrefixes(CreateDumpVerboseDiagnosticsVariable, EnabledValue); if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) { - foreach (string prefix in Prefixes) - { - if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportVariable}", out OwnedEnvironmentVariable? enableCrashReport) - || enableCrashReport.Value != EnabledValue) - { - AddError(errors, $"{prefix}{EnableCrashReportVariable}", EnabledValue, enableCrashReport?.Value); - } - } + ValidateBothPrefixes(EnableCrashReportVariable, EnabledValue); } if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) { - foreach (string prefix in Prefixes) - { - if (!environmentVariables.TryGetVariable($"{prefix}{EnableCrashReportOnlyVariable}", out OwnedEnvironmentVariable? enableCrashReportOnly) - || enableCrashReportOnly.Value != EnabledValue) - { - AddError(errors, $"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, enableCrashReportOnly?.Value); - } - } + ValidateBothPrefixes(EnableCrashReportOnlyVariable, EnabledValue); } foreach (string prefix in Prefixes) @@ -260,6 +225,18 @@ static void AddError(StringBuilder errors, string variableName, string? expected string actualValueString = actualValue ?? ""; errors.AppendLine(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CrashDumpInvalidEnvironmentVariableValueErrorMessage, variableName, expectedValue, actualValueString)); } + + void ValidateBothPrefixes(string variableName, string expectedValue) + { + foreach (string prefix in Prefixes) + { + if (!environmentVariables.TryGetVariable($"{prefix}{variableName}", out OwnedEnvironmentVariable? variable) + || variable.Value != expectedValue) + { + AddError(errors, $"{prefix}{variableName}", expectedValue, variable?.Value); + } + } + } #endif } } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs index 13dfee21c7..df73fe063c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs @@ -14,6 +14,9 @@ namespace Microsoft.Testing.Extensions.Diagnostics; internal sealed class CrashDumpProcessLifetimeHandler : ITestHostProcessLifetimeHandler, IDataProducer, IOutputDeviceDataProducer { + private const string CrashReportFileExtension = ".crashreport.json"; + private const string CrashReportFileSearchPattern = "*" + CrashReportFileExtension; + private readonly ICommandLineOptions _commandLineOptions; private readonly IMessageBus _messageBus; private readonly IOutputDevice _outputDisplay; @@ -99,15 +102,15 @@ public async Task OnTestHostProcessExitedAsync(ITestHostProcessInformation testH if (generateCrashReport) { - string expectedCrashReportFile = $"{expectedDumpFile}.crashreport.json"; + string expectedCrashReportFile = $"{expectedDumpFile}{CrashReportFileExtension}"; if (File.Exists(expectedCrashReportFile)) { await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(expectedCrashReportFile), CrashDumpResources.CrashReportArtifactDisplayName, CrashDumpResources.CrashReportArtifactDescription)).ConfigureAwait(false); } else { - await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CannotFindExpectedCrashReportFile, expectedCrashReportFile)), cancellationToken).ConfigureAwait(false); - foreach (string crashReportFile in Directory.GetFiles(Path.GetDirectoryName(expectedCrashReportFile)!, "*.crashreport.json")) + await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CannotFindExpectedCrashReportFile, expectedCrashReportFile, CrashReportFileSearchPattern)), cancellationToken).ConfigureAwait(false); + foreach (string crashReportFile in Directory.GetFiles(Path.GetDirectoryName(expectedCrashReportFile)!, CrashReportFileSearchPattern)) { await _messageBus.PublishAsync(this, new FileArtifact(new FileInfo(crashReportFile), CrashDumpResources.CrashReportArtifactDisplayName, CrashDumpResources.CrashReportArtifactDescription)).ConfigureAwait(false); } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx index 28b6da6b47..41cf75dab6 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx @@ -121,7 +121,7 @@ Expected crash dump file '{0}' could not be found, all files matching the '*.dmp' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder The testhost process crash dump file @@ -163,7 +163,7 @@ [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line Test host process with PID '{0}' crashed, a dump file and crash report were generated diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf index 5cfe2cf444..c37564ee81 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Další informace najdete na https://learn.microsoft.com/dotnet/core/diagnostics - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf index f7c9a94de0..5147d3176c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Weitere Informationen finden Sie unter https://learn.microsoft.com/dotnet/core/d - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf index 419877a33e..d4b87efa80 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Para obtener más información, visite https://learn.microsoft.com/dotnet/core/d - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf index cea7dac669..d00378295a 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Pour plus d’informations, visitez https://learn.microsoft.com/dotnet/core/diag - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf index 64175470d2..b418d3d0e6 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Per altre informazioni, visitare https://learn.microsoft.com/dotnet/core/diagnos - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf index 02b8376ca9..90ba565e41 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf index 21bdc4b5d4..c4c1a66ac1 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf index 116d061cc2..60f0ac2c70 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Aby uzyskać więcej informacji, odwiedź stronę https://learn.microsoft.com/do - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf index 9c6a5b5d8b..bee621996d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Para obter mais informações, visite https://learn.microsoft.com/dotnet/core/di - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf index 12b20d9441..90afa74d4d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf index 84e0f1b421..1e246b6481 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ Daha fazla bilgi için https://learn.microsoft.com/dotnet/core/diagnostics/colle - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf index 3e48000502..114fcac993 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf index 37e724192c..6d2dd225ea 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf @@ -8,8 +8,8 @@ - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder - Expected crash report file '{0}' could not be found, all files matching the '*.crashreport.json' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder + Expected crash report file '{0}' could not be found, all files matching the '{1}' pattern will be copied to the result folder @@ -112,8 +112,8 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line - You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 29aa995b48..7d1124acca 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -57,7 +57,7 @@ public async Task CrashDump_WithCrashReport_CreateDumpAndCrashReport() } [TestMethod] - public async Task CrashReportOnly_CustomDumpName_CreateOnlyCrashReport() + public async Task CrashReportOnly_WithCustomDumpFilename_CreatesOnlyCrashReport() { string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); @@ -90,7 +90,7 @@ public async Task CrashReport_Without_CrashDump_ShouldFail() var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); testHostResult.AssertExitCodeIs(ExitCode.InvalidCommandLine); - testHostResult.AssertOutputContains("You specified '--crashreport' but did not enable crash dumps, add --crashdump to the command line"); + testHostResult.AssertOutputContains("You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line"); } public sealed class TestAssetFixture() : TestAssetFixtureBase() diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs index b3a834c1e7..fcd087b3a5 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs @@ -76,13 +76,15 @@ public async Task CrashReport_Alongside_CrashDump_Is_Valid() Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); } + [DataRow(CrashDumpCommandLineOptions.CrashDumpOptionName)] + [DataRow(CrashDumpCommandLineOptions.CrashReportOptionName)] [TestMethod] - public async Task CrashReportOnly_Cannot_Be_Combined_With_Other_Crash_Options() + public async Task CrashReportOnly_Cannot_Be_Combined_With_Other_Crash_Options(string otherCrashOption) { var provider = new CrashDumpCommandLineProvider(); var options = new Dictionary { - { CrashDumpCommandLineOptions.CrashDumpOptionName, [] }, + { otherCrashOption, [] }, { CrashDumpCommandLineOptions.CrashReportOnlyOptionName, [] }, }; From 64d9b6f945746f5bf23820df6f6d3b3a45359a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 15 May 2026 16:16:22 +0200 Subject: [PATCH 7/7] Rename --crashreport to --crash-report and merge with --crashreport-only Replaces the two-flag design (--crashreport + --crashreport-only) with a single composable flag --crash-report. Behavior: - '--crashdump' alone: dump only (unchanged) - '--crash-report' alone: report only (DOTNET_EnableCrashReportOnly=1) - '--crashdump --crash-report': both (DOTNET_EnableCrashReport=1) Removes obsolete validation rules and resource strings (CrashReportRequiresCrashDumpErrorMessage, CrashReportOnlyCannotBeCombinedErrorMessage, CrashReportOnlyOptionDescription) and the corresponding XLF entries. Updates PACKAGE.md, unit tests, acceptance tests and HelpInfoAllExtensionsTests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CrashDumpCommandLineOptions.cs | 3 +- .../CrashDumpCommandLineProvider.cs | 20 +--------- .../CrashDumpEnvironmentVariableProvider.cs | 36 +++++++----------- .../CrashDumpProcessLifetimeHandler.cs | 6 +-- .../PACKAGE.md | 2 +- .../Resources/CrashDumpResources.resx | 11 +----- .../Resources/xlf/CrashDumpResources.cs.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.de.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.es.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.fr.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.it.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.ja.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.ko.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.pl.xlf | 19 +--------- .../xlf/CrashDumpResources.pt-BR.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.ru.xlf | 19 +--------- .../Resources/xlf/CrashDumpResources.tr.xlf | 19 +--------- .../xlf/CrashDumpResources.zh-Hans.xlf | 19 +--------- .../xlf/CrashDumpResources.zh-Hant.xlf | 19 +--------- .../CrashDumpTests.cs | 16 ++------ .../HelpInfoAllExtensionsTests.cs | 14 ++----- .../CrashDumpTests.cs | 37 ++----------------- 22 files changed, 55 insertions(+), 337 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs index da7a6bebbc..45b2b5924c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineOptions.cs @@ -10,8 +10,7 @@ namespace Microsoft.Testing.Extensions.Diagnostics; internal static class CrashDumpCommandLineOptions { public const string CrashDumpOptionName = "crashdump"; - public const string CrashReportOptionName = "crashreport"; - public const string CrashReportOnlyOptionName = "crashreport-only"; + public const string CrashReportOptionName = "crash-report"; public const string CrashDumpFileNameOptionName = "crashdump-filename"; public const string CrashDumpTypeOptionName = "crashdump-type"; } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs index 0b82a33d73..202ad20eea 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs @@ -15,7 +15,6 @@ internal sealed class CrashDumpCommandLineProvider : ICommandLineOptionsProvider [ new(CrashDumpCommandLineOptions.CrashDumpOptionName, CrashDumpResources.CrashDumpOptionDescription, ArgumentArity.Zero, false), new(CrashDumpCommandLineOptions.CrashReportOptionName, CrashDumpResources.CrashReportOptionDescription, ArgumentArity.Zero, false), - new(CrashDumpCommandLineOptions.CrashReportOnlyOptionName, CrashDumpResources.CrashReportOnlyOptionDescription, ArgumentArity.Zero, false), new(CrashDumpCommandLineOptions.CrashDumpFileNameOptionName, CrashDumpResources.CrashDumpFileNameOptionDescription, ArgumentArity.ExactlyOne, false), new(CrashDumpCommandLineOptions.CrashDumpTypeOptionName, CrashDumpResources.CrashDumpTypeOptionDescription, ArgumentArity.ExactlyOne, false) ]; @@ -47,22 +46,5 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com } public Task ValidateCommandLineOptionsAsync(ICommandLineOptions commandLineOptions) - { - bool isCrashDumpSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); - bool isCrashReportSet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); - bool isCrashReportOnlySet = commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); - - if (isCrashReportOnlySet && (isCrashDumpSet || isCrashReportSet)) - { - return ValidationResult.InvalidTask(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage); - } - - if (isCrashReportSet && !isCrashDumpSet) - { - return ValidationResult.InvalidTask(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage); - } - - // No problem found - return ValidationResult.ValidTask; - } + => ValidationResult.ValidTask; } diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs index a190706052..856b3cd4df 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs @@ -58,17 +58,15 @@ public CrashDumpEnvironmentVariableProvider( public Task IsEnabledAsync() => Task.FromResult( (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) && + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) && _crashDumpGeneratorConfiguration.Enable); public Task UpdateAsync(IEnvironmentVariables environmentVariables) { bool crashDumpEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); bool crashReportEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); - bool crashReportOnlyEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); - if (crashDumpEnabled || crashReportEnabled || crashReportOnlyEnabled) + if (crashDumpEnabled || crashReportEnabled) { foreach (string prefix in Prefixes) { @@ -84,17 +82,12 @@ public Task UpdateAsync(IEnvironmentVariables environmentVariables) if (crashReportEnabled) { + // When a dump is also requested, emit a crash report alongside it. + // Otherwise emit only the crash report (no dump file). + string reportVariable = crashDumpEnabled ? EnableCrashReportVariable : EnableCrashReportOnlyVariable; foreach (string prefix in Prefixes) { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportVariable}", EnabledValue, false, true)); - } - } - - if (crashReportOnlyEnabled) - { - foreach (string prefix in Prefixes) - { - environmentVariables.SetVariable(new($"{prefix}{EnableCrashReportOnlyVariable}", EnabledValue, false, true)); + environmentVariables.SetVariable(new($"{prefix}{reportVariable}", EnabledValue, false, true)); } } @@ -166,9 +159,10 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl return ValidationResult.InvalidTask(CrashDumpResources.CrashDumpNotSupportedInNonNetCoreErrorMessage); #else StringBuilder errors = new(); - if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) + bool crashDumpEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); + bool crashReportEnabled = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); + + if (crashDumpEnabled || crashReportEnabled) { ValidateBothPrefixes(EnableMiniDumpVariable, EnabledValue); } @@ -176,14 +170,10 @@ public Task ValidateTestHostEnvironmentVariablesAsync(IReadOnl ValidateBothPrefixes(CreateDumpDiagnosticsVariable, EnabledValue); ValidateBothPrefixes(CreateDumpVerboseDiagnosticsVariable, EnabledValue); - if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) - { - ValidateBothPrefixes(EnableCrashReportVariable, EnabledValue); - } - - if (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) + if (crashReportEnabled) { - ValidateBothPrefixes(EnableCrashReportOnlyVariable, EnabledValue); + string reportVariable = crashDumpEnabled ? EnableCrashReportVariable : EnableCrashReportOnlyVariable; + ValidateBothPrefixes(reportVariable, EnabledValue); } foreach (string prefix in Prefixes) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs index df73fe063c..36ee324349 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpProcessLifetimeHandler.cs @@ -51,8 +51,7 @@ public CrashDumpProcessLifetimeHandler( public Task IsEnabledAsync() => Task.FromResult( (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName)) && + _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) && _netCoreCrashDumpGeneratorConfiguration.Enable); public Task BeforeTestHostProcessStartAsync(CancellationToken _) => Task.CompletedTask; @@ -70,8 +69,7 @@ public async Task OnTestHostProcessExitedAsync(ITestHostProcessInformation testH ApplicationStateGuard.Ensure(_netCoreCrashDumpGeneratorConfiguration.DumpFileNamePattern is not null); bool generateDump = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName); - bool generateCrashReport = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName) || - _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOnlyOptionName); + bool generateCrashReport = _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName); string processCrashedMessage = generateDump && generateCrashReport ? string.Format(CultureInfo.InvariantCulture, CrashDumpResources.CrashDumpProcessCrashedDumpAndReportFileCreated, testHostProcessInformation.PID) diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md b/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md index 9d34f5a7d7..ef035d0c09 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/PACKAGE.md @@ -21,7 +21,7 @@ This package extends Microsoft.Testing.Platform with: - **Runtime behavior**: supported for .NET 6+; on .NET Framework this extension is ignored Enable crash dump collection via the `--crashdump` command line option. -Add `--crashreport` to generate a dump and crash report together, or use `--crashreport-only` to generate only the crash report. +Add `--crash-report` to generate a JSON crash report; combine `--crashdump --crash-report` to produce both a dump and a report. ## Related packages diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx index 41cf75dab6..9701e8df51 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/CrashDumpResources.resx @@ -153,17 +153,8 @@ Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - [net7.0+ only] Generate only a crash report file if the test process crashes - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. Test host process with PID '{0}' crashed, a dump file and crash report were generated diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf index c37564ee81..07299de040 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.cs.xlf @@ -96,24 +96,9 @@ Další informace najdete na https://learn.microsoft.com/dotnet/core/diagnostics Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf index 5147d3176c..7ab142bb66 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.de.xlf @@ -96,24 +96,9 @@ Weitere Informationen finden Sie unter https://learn.microsoft.com/dotnet/core/d Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf index d4b87efa80..11a4e1e3bd 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.es.xlf @@ -96,24 +96,9 @@ Para obtener más información, visite https://learn.microsoft.com/dotnet/core/d Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf index d00378295a..25293b003c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.fr.xlf @@ -96,24 +96,9 @@ Pour plus d’informations, visitez https://learn.microsoft.com/dotnet/core/diag Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf index b418d3d0e6..f38cc7bad9 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.it.xlf @@ -96,24 +96,9 @@ Per altre informazioni, visitare https://learn.microsoft.com/dotnet/core/diagnos Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf index 90ba565e41..b8a3936c3d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ja.xlf @@ -96,24 +96,9 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf index c4c1a66ac1..119110736b 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ko.xlf @@ -96,24 +96,9 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf index 60f0ac2c70..c19b5aaf80 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pl.xlf @@ -96,24 +96,9 @@ Aby uzyskać więcej informacji, odwiedź stronę https://learn.microsoft.com/do Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf index bee621996d..f8e872ca1a 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.pt-BR.xlf @@ -96,24 +96,9 @@ Para obter mais informações, visite https://learn.microsoft.com/dotnet/core/di Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf index 90afa74d4d..cf8d3453a5 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.ru.xlf @@ -96,24 +96,9 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf index 1e246b6481..33d336829b 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.tr.xlf @@ -96,24 +96,9 @@ Daha fazla bilgi için https://learn.microsoft.com/dotnet/core/diagnostics/colle Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf index 114fcac993..c94993411a 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hans.xlf @@ -96,24 +96,9 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf index 6d2dd225ea..a23faf719e 100644 --- a/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.CrashDump/Resources/xlf/CrashDumpResources.zh-Hant.xlf @@ -96,24 +96,9 @@ For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/c Crash report file - - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - '--crashreport-only' can't be combined with '--crashdump' or '--crashreport' - - - - [net7.0+ only] Generate only a crash report file if the test process crashes - [net7.0+ only] Generate only a crash report file if the test process crashes - - - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - - - - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line - You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 7d1124acca..da3839b077 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -49,7 +49,7 @@ public async Task CrashDump_WithCrashReport_CreateDumpAndCrashReport() { string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); - TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashdump --crashreport --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); + TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashdump --crash-report --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); Assert.ContainsSingle(Directory.GetFiles(resultDirectory, "CrashDump_*.dmp", SearchOption.AllDirectories), $"Dump file not found\n{testHostResult}"); @@ -57,11 +57,11 @@ public async Task CrashDump_WithCrashReport_CreateDumpAndCrashReport() } [TestMethod] - public async Task CrashReportOnly_WithCustomDumpFilename_CreatesOnlyCrashReport() + public async Task CrashReport_WithCustomDumpFilename_CreatesOnlyCrashReport() { string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); - TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport-only --crashdump-filename customdumpname.dmp --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); + TestHostResult testHostResult = await testHost.ExecuteAsync($"--crash-report --crashdump-filename customdumpname.dmp --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); testHostResult.AssertExitCodeIs(ExitCode.TestHostProcessExitedNonGracefully); // Use an explicit equality check on the file name rather than relying on Directory.GetFiles' pattern matching, @@ -83,16 +83,6 @@ public async Task CrashDump_InvalidFormat_ShouldFail() testHostResult.AssertOutputContains("Option '--crashdump-type' has invalid arguments: 'invalid' is not a valid dump type. Valid options are 'Mini', 'Heap', 'Triage' and 'Full'"); } - [TestMethod] - public async Task CrashReport_Without_CrashDump_ShouldFail() - { - string resultDirectory = Path.Combine(AssetFixture.TargetAssetPath, Guid.NewGuid().ToString("N")); - var testHost = TestInfrastructure.TestHost.LocateFrom(AssetFixture.TargetAssetPath, "CrashDump", TargetFrameworks.NetCurrent); - TestHostResult testHostResult = await testHost.ExecuteAsync($"--crashreport --results-directory {resultDirectory}", cancellationToken: TestContext.CancellationToken); - testHostResult.AssertExitCodeIs(ExitCode.InvalidCommandLine); - testHostResult.AssertOutputContains("You specified '--crashreport' but did not enable crash dumps, add '--crashdump' to the command line"); - } - public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "CrashDumpFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index 168ba96d85..d3ca28b52a 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -76,10 +76,8 @@ Specify the name of the dump file Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/collect-dumps-crash#types-of-mini-dumps - --crashreport - [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - --crashreport-only - [net7.0+ only] Generate only a crash report file if the test process crashes + --crash-report + Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. --hangdump Generate a dump file if the test process hangs --hangdump-filename @@ -284,14 +282,10 @@ Takes one argument as string in the format [h|m|s] where 'value' is float Description: Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/collect-dumps-crash#types-of-mini-dumps - --crashreport + --crash-report Arity: 0 Hidden: False - Description: [net6.0+ only] Generate a crash report file if the test process crashes. Requires '--crashdump'. - --crashreport-only - Arity: 0 - Hidden: False - Description: [net7.0+ only] Generate only a crash report file if the test process crashes + Description: Generate a JSON crash report when the test process crashes. Combine with '--crashdump' to also generate a dump file. Requires .NET 7+ when used alone; .NET 6+ when combined with '--crashdump'. HangDumpCommandLineProvider Name: Hang dump Version: * diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs index fcd087b3a5..1cd86a476d 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs @@ -48,7 +48,7 @@ public async Task CrashDump_CommandLineOptions_Are_Valid_ByDefault() } [TestMethod] - public async Task CrashReport_Without_CrashDump_Is_Invalid() + public async Task CrashReport_Without_CrashDump_Is_Valid() { var provider = new CrashDumpCommandLineProvider(); var options = new Dictionary @@ -57,8 +57,8 @@ public async Task CrashReport_Without_CrashDump_Is_Invalid() }; ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); - Assert.IsFalse(validateOptionsResult.IsValid); - Assert.AreEqual(CrashDumpResources.CrashReportRequiresCrashDumpErrorMessage, validateOptionsResult.ErrorMessage); + Assert.IsTrue(validateOptionsResult.IsValid); + Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); } [TestMethod] @@ -75,35 +75,4 @@ public async Task CrashReport_Alongside_CrashDump_Is_Valid() Assert.IsTrue(validateOptionsResult.IsValid); Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); } - - [DataRow(CrashDumpCommandLineOptions.CrashDumpOptionName)] - [DataRow(CrashDumpCommandLineOptions.CrashReportOptionName)] - [TestMethod] - public async Task CrashReportOnly_Cannot_Be_Combined_With_Other_Crash_Options(string otherCrashOption) - { - var provider = new CrashDumpCommandLineProvider(); - var options = new Dictionary - { - { otherCrashOption, [] }, - { CrashDumpCommandLineOptions.CrashReportOnlyOptionName, [] }, - }; - - ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); - Assert.IsFalse(validateOptionsResult.IsValid); - Assert.AreEqual(CrashDumpResources.CrashReportOnlyCannotBeCombinedErrorMessage, validateOptionsResult.ErrorMessage); - } - - [TestMethod] - public async Task CrashReportOnly_Alone_Is_Valid() - { - var provider = new CrashDumpCommandLineProvider(); - var options = new Dictionary - { - { CrashDumpCommandLineOptions.CrashReportOnlyOptionName, [] }, - }; - - ValidationResult validateOptionsResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(options)).ConfigureAwait(false); - Assert.IsTrue(validateOptionsResult.IsValid); - Assert.IsTrue(string.IsNullOrEmpty(validateOptionsResult.ErrorMessage)); - } }