Skip to content

[MTP CLI Analysis] --hangdump-type help advertises target-dependent values incorrectly #8431

@Evangelink

Description

@Evangelink

Summary

--hangdump-type help and validation text advertise the wrong valid-value set for some target frameworks. The shared resource strings say Triage is valid and that None is only available in .NET 6+, but the actual validator uses a different conditional list.

Evidence

  • src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs:19-23

    #if NETCOREAPP private static readonly string[] HangDumpTypeOptions = ["Mini", "Heap", "Full", "Triage", "None"];
    #else private static readonly string[] HangDumpTypeOptions = ["Mini", "Heap", "Full", "None"];

  • src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs:52-57

    if (!HangDumpTypeOptions.Contains(arguments[0], StringComparer.OrdinalIgnoreCase)) { return ValidationResult.InvalidTask(...); }

  • src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/ExtensionResources.resx:189-197

    Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'.
    Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full'

  • est/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs:95-98

Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'.

Why this is a real issue

On a non-NETCOREAPP target, help currently tells users that Triage is valid even though the validator will reject it, because the non-NETCOREAPP list does not contain Triage. The same text also understates None support by calling it .NET 6+-only even though the non-NETCOREAPP branch still allows None. That is a concrete help/validation mismatch, not a theoretical cleanup.

Suggested resolution

Generate or select the valid-value help text from the same target-specific source used by the validator. At minimum, make the resource text match the #if NETCOREAPP / #else option lists so the help output and error messages stop promising values the validator rejects.

Related issues

None found.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions