Skip to content

Fix dotnet run tests for launch settings stderr change#53908

Closed
jaredpar wants to merge 1 commit intodotnet:mainfrom
jaredpar:fix-launch-profile-stderr
Closed

Fix dotnet run tests for launch settings stderr change#53908
jaredpar wants to merge 1 commit intodotnet:mainfrom
jaredpar:fix-launch-profile-stderr

Conversation

@jaredpar
Copy link
Copy Markdown
Member

Commit 1ebcc5e correctly moved the 'Using launch settings from...' message from stdout to stderr (fixing #45640), but only updated the dotnet test tests. The dotnet run tests still asserted empty stderr and checked stdout for the message, causing 10 tests to fail across all platforms in every CI build.

Update the dotnet run test assertions to match the new behavior:

  • Tests using launch profiles now expect the message on stderr instead of asserting stderr is empty
  • ItPrintsUsingLaunchSettingsMessageWhenNotQuiet checks stderr instead of stdout for the message
  • Tests using --no-launch-profile or --verbosity quiet correctly continue to assert empty stderr

Fixes #53879

Commit 1ebcc5e correctly moved the 'Using launch settings from...'
message from stdout to stderr (fixing dotnet#45640), but only updated the
dotnet test tests. The dotnet run tests still asserted empty stderr
and checked stdout for the message, causing 10 tests to fail across
all platforms in every CI build.

Update the dotnet run test assertions to match the new behavior:
- Tests using launch profiles now expect the message on stderr
  instead of asserting stderr is empty
- ItPrintsUsingLaunchSettingsMessageWhenNotQuiet checks stderr
  instead of stdout for the message
- Tests using --no-launch-profile or --verbosity quiet correctly
  continue to assert empty stderr

Fixes dotnet#53879

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 00:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates dotnet run test expectations to align with the recent behavior change that prints the “Using launch settings from …” message to stderr (instead of stdout), fixing CI failures after the change made for #45640.

Changes:

  • Update dotnet run tests to expect the launch settings banner on stderr when launch profiles are used.
  • Switch “not quiet” banner assertions to check stderr rather than stdout.
  • Keep assertions that stderr is empty for scenarios like --verbosity quiet / --no-launch-profile.
Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Run/RunCommandTests.cs Adjusts stderr expectations for launch settings usage in environment variable expansion test.
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsVbProj.cs Updates VB project run tests to assert the launch settings message appears on stderr.
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs Updates C# project run tests to assert the launch settings message appears on stderr and moves the “not quiet” check accordingly.

Copilot's findings

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

Comment on lines 108 to +112
cmd.Should().Pass()
.And.NotHaveStdOutContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdOutContaining("First");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain("Using launch settings from");
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

In ItDefaultsToTheFirstUsableLaunchProfile, the NotHaveStdOutContaining(string.Format(..., launchSettingsPath)) check is likely ineffective because VbAppWithLaunchSettings has launchSettings.json under My Project (not Properties). Consider updating the expected path (or asserting only on the stable prefix) so this test actually verifies the launch settings message is not written to stdout.

Copilot uses AI. Check for mistakes.
@baronfel
Copy link
Copy Markdown
Member

I think there's overlap with @MichaelSimons's PR over in #53905 here.

@jaredpar
Copy link
Copy Markdown
Member Author

If he's working on it then I'll defer to him. Was just going through my Copilot triage tool, and it had a ready fix for this I wanted to try

@jaredpar jaredpar closed this Apr 16, 2026
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.

[Known Build Error] dotnet run launch profile tests fail due to unexpected 'Using launch settings' stderr output

3 participants