Skip to content

[MTP Diagnostic Analysis] CrashDump sub-options are silently ignored without --crashdump/--crash-report #8407

@Evangelink

Description

@Evangelink

Summary

Microsoft.Testing.Extensions.CrashDump accepts --crashdump-filename and --crashdump-type without requiring --crashdump or --crash-report. Unlike HangDump, those sub-options are not rejected when the main feature is off, so they are silently ignored.

Evidence

  • Q:\src\testfx\src\Platform\Microsoft.Testing.Extensions.CrashDump\CrashDumpCommandLineProvider.cs:16-19
    • new(CrashDumpCommandLineOptions.CrashDumpFileNameOptionName, ..., ArgumentArity.ExactlyOne, false),
    • new(CrashDumpCommandLineOptions.CrashDumpTypeOptionName, ..., ArgumentArity.ExactlyOne, false)
  • Q:\src\testfx\src\Platform\Microsoft.Testing.Extensions.CrashDump\CrashDumpCommandLineProvider.cs:48-52
    • => commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)
    • ... ? ValidationResult.InvalidTask(...) : ValidationResult.ValidTask;
  • Q:\src\testfx\src\Platform\Microsoft.Testing.Extensions.CrashDump\CrashDumpEnvironmentVariableProvider.cs:56-60
    • (_commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashDumpOptionName) ||
    • _commandLineOptions.IsOptionSet(CrashDumpCommandLineOptions.CrashReportOptionName)) &&
    • _crashDumpGeneratorConfiguration.Enable

For comparison, HangDump already validates the same pattern:

  • Q:\src\testfx\src\Platform\Microsoft.Testing.Extensions.HangDump\HangDumpCommandLineProvider.cs:63-69
    • (commandLineOptions.IsOptionSet(HangDumpTimeoutOptionName) || ... ) && !commandLineOptions.IsOptionSet(HangDumpOptionName)
    • ? ValidationResult.InvalidTask(ExtensionResources.MissingHangDumpMainOption)

Why this is a real issue

A user can pass --crashdump-filename or --crashdump-type and get no validation error, but the crash dump environment-variable provider never activates unless --crashdump or --crash-report is also set. That makes the options look accepted even though they have no effect.

Suggested resolution

Add ValidateCommandLineOptionsAsync validation equivalent to HangDump, so --crashdump-filename / --crashdump-type require --crashdump or --crash-report. Add acceptance/unit coverage for the invalid combinations.

Related issues

  • None found

Metadata

Metadata

Labels

area/dumpCrashDump / HangDump extensions.area/mtp-extensionsMTP extensions (TrxReport, Retry, HtmlReport, ...).type/automationCreated or maintained by an agentic workflow.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions