Skip to content

[MTP] Flag bootstrap-only CLI options (--config-file, --diagnostic*) when set in testconfig.json #8829

Description

@Evangelink

Follow-up from #6349 / #8664.

A few CLI options are intentionally read off parseResult before IConfiguration is built and therefore cannot be honored from testconfig.json:

  • --config-file (chicken-and-egg: it tells the system where to find the JSON)
  • --diagnostic* (needed before the config system is up so we can log config-build itself)

Today, if a user puts these under commandLineOptions in testconfig.json they are silently ignored, which is confusing.

Proposal

Extend CommandLineOptionsValidator's JSON pass (added in #8664) with a known list of bootstrap-only options. When any of those appear under commandLineOptions in testconfig.json, fail startup with a clear error explaining the option must be passed on the CLI.

Pseudo:

csharp private static readonly HashSet<string> s_bootstrapOnlyOptions = new(StringComparer.OrdinalIgnoreCase) { "config-file", "diagnostic", "diagnostic-output-directory", "diagnostic-output-fileprefix", "diagnostic-verbosity", "diagnostic-filelogger-synchronouswrite", };

(Exact list TBD — whatever ConfigurationManager / parseResult reads pre-config.)

Alternative: log a warning instead of failing, if we want to stay lenient. I'd lean toward fail-fast since the user clearly intended for the option to take effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mtpMicrosoft.Testing.Platform core library.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions