Skip to content

Support --nologo in Microsoft.Testing.Platform test mode - #55376

Merged
Evangelink merged 3 commits into
mainfrom
dev/amauryleve/investigate-mtp-nologo
Jul 22, 2026
Merged

Evangelink merged 3 commits into
mainfrom
dev/amauryleve/investigate-mtp-nologo

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Fixes #55309.

Summary

When dotnet test uses Microsoft.Testing.Platform, --nologo is currently treated as an unmatched extension option and forwarded unchanged to each test application. MTP recognizes --no-banner instead, so it exits with code 5 before test discovery.

This change:

  • recognizes the common --no-logo, --nologo, -nologo, and /nologo aliases in MTP mode
  • translates the enabled option to MTP's --no-banner
  • honors DOTNET_NOLOGO while preserving the default behavior when it is unset
  • avoids duplicating an explicitly supplied --no-banner
  • updates MTP help output
  • adds coverage that unsupported extension options continue flowing to the test application and that pre-handshake command-line errors are surfaced by the SDK

Unknown options must continue to flow through because MTP extensions dynamically contribute command-line options; the SDK cannot reject them during its initial parse. The SDK's existing handshake-failure path on main captures and reports the child application's actionable stderr. That diagnostic improvement should also be considered for backport to .NET 10, where the reported opaque output occurs.

Validation

  • Built src/Cli/dotnet/dotnet.csproj
  • Passed 62 TestCommandDefinitionTests
  • Verified through a child-process argument capture that --nologo becomes --no-banner and is not forwarded to MSBuild
  • Verified an unsupported child option's stderr is included in the failed summary and handshake-failure recap

Recognize the common no-logo aliases in the Microsoft.Testing.Platform dotnet test command and translate them to MTP's --no-banner option. Add coverage for argument routing, DOTNET_NOLOGO, help output, and surfacing invalid child options.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20c78411-66f5-4a42-a00d-2e719b93721b
Copilot AI review requested due to automatic review settings July 20, 2026 12:45
@Evangelink
Evangelink requested review from a team as code owners July 20, 2026 12:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes dotnet test behavior when running in Microsoft.Testing.Platform (MTP) mode by recognizing common --nologo spellings and translating them to MTP’s --no-banner, preventing test apps from failing pre-discovery due to an unrecognized option.

Changes:

  • Add --no-logo/--nologo/-nologo//nologo support to the MTP dotnet test parser and map it to --no-banner for test application invocation (including honoring DOTNET_NOLOGO).
  • Update MTP help snapshot output to include the new -nologo, --no-logo option.
  • Add tests covering translation, de-duplication with explicit --no-banner, env var behavior, and surfacing pre-handshake CLI errors from the child app.
Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs Adds parser/build-options tests for --nologo aliases, --no-banner de-duplication, and DOTNET_NOLOGO.
test/dotnet.Tests/CommandTests/Test/snapshots/MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt Updates verified help output to include the new -nologo, --no-logo option.
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs Adds an end-to-end test asserting child pre-handshake invalid-option stderr is surfaced in SDK output.
src/Cli/Microsoft.DotNet.Cli.Definitions/Common/CommonOptions.cs Allows CreateNoLogoOption to be created without forwarding (supports MTP mapping behavior).
src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Test/TestCommandDefinition.MicrosoftTestingPlatform.cs Defines and registers NoLogoOption in the MTP test command.
src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs Translates parsed NoLogoOption to --no-banner in test application args (avoids duplicates).

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20c78411-66f5-4a42-a00d-2e719b93721b
Qualify System.Console so the dynamically replaced Program.cs builds without implicit usings on Helix.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20c78411-66f5-4a42-a00d-2e719b93721b
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g #55408

@Evangelink
Evangelink enabled auto-merge July 22, 2026 14:12
-v, -verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
--no-restore Do not restore the project before building. [default: False]
--no-build Do not build the project before testing. Implies --no-restore. [default: False]
-nologo, --no-logo Run test(s), without displaying Microsoft Testplatform banner [default: False]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is no banner a hidden option? why is it not listed in the help?

@Evangelink
Evangelink merged commit bf68967 into main Jul 22, 2026
32 of 34 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/investigate-mtp-nologo branch July 22, 2026 14:17
@Evangelink

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx-preview7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview7 (link to workflow run)

@Evangelink

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx-preview7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview7 (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@Evangelink backporting to release/11.0.1xx-preview7 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Support --nologo in MTP test mode
Using index info to reconstruct a base tree...
M	src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Test/TestCommandDefinition.MicrosoftTestingPlatform.cs
M	src/Cli/Microsoft.DotNet.Cli.Definitions/Common/CommonOptions.cs
M	src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs
M	test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs
M	test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs
M	test/dotnet.Tests/CommandTests/Test/snapshots/MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt
Falling back to patching base and 3-way merge...
Auto-merging src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs
Auto-merging test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs
CONFLICT (content): Merge conflict in test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Support --nologo in MTP test mode
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

-v, -verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
--no-restore Do not restore the project before building. [default: False]
--no-build Do not build the project before testing. Implies --no-restore. [default: False]
-nologo, --no-logo Run test(s), without displaying Microsoft Testplatform banner [default: False]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft.Testing.Platform?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet test opaquely fails with Zero tests ran in MTP mode when --nologo is used

5 participants