Skip to content

Update dotnet run tests for launch settings message on stderr#53905

Merged
MichaelSimons merged 6 commits intomainfrom
fix/update-run-tests-for-stderr-launch-settings
Apr 16, 2026
Merged

Update dotnet run tests for launch settings message on stderr#53905
MichaelSimons merged 6 commits intomainfrom
fix/update-run-tests-for-stderr-launch-settings

Conversation

@MichaelSimons
Copy link
Copy Markdown
Member

@MichaelSimons MichaelSimons commented Apr 15, 2026

Fixes #53879

PR #53797 moved the 'Using launch settings from...' message from stdout to stderr but only updated dotnet test assertions. This updates the dotnet run test assertions to match:

  • StdErr.Should().BeEmpty() → StdErr.Should().Contain('Using launch settings from') for tests that use launch profiles
  • HaveStdOutContaining(UsingLaunchSettingsFromMessage) → HaveStdErrContaining
  • NotHaveStdOutContaining(UsingLaunchSettingsFromMessage) → NotHaveStdErrContaining

Fixes ~11 test failures across Windows, Linux, and macOS CI legs.

These test failures weren't surfaced in #53797 because we had a test outage last week.

PR #53797 moved the 'Using launch settings from...' message from stdout
to stderr but only updated dotnet test assertions. This updates the
dotnet run test assertions to match:

- StdErr.Should().BeEmpty() → StdErr.Should().Contain('Using launch settings from')
  for tests that use launch profiles
- HaveStdOutContaining(UsingLaunchSettingsFromMessage) → HaveStdErrContaining
- NotHaveStdOutContaining(UsingLaunchSettingsFromMessage) → NotHaveStdErrContaining

Fixes ~11 test failures across Windows, Linux, and macOS CI legs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 15, 2026 23:29
@MichaelSimons MichaelSimons requested a review from baronfel April 15, 2026 23:30
@MichaelSimons
Copy link
Copy Markdown
Member Author

@Christian-Sidak, Can you please review? TIA

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 tests to reflect the behavioral change from PR #53797 where the “Using launch settings from …” diagnostic is written to stderr instead of stdout, fixing CI test failures across platforms.

Changes:

  • Adjusts assertions in run-related tests to expect the launch settings message on stderr.
  • Replaces Have/NotHaveStdOutContaining(UsingLaunchSettingsFromMessage) with the corresponding stderr variants for launch-profile scenarios.
  • Updates tests that previously asserted empty stderr to instead assert presence/absence of the launch settings diagnostic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/dotnet.Tests/CommandTests/Run/RunCommandTests.cs Updates stderr expectations for launch settings diagnostics in a dotnet run integration test.
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsVbProj.cs Moves launch settings message assertions to stderr for VB dotnet run tests.
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs Moves launch settings message assertions to stderr for C# dotnet run tests and updates quiet/non-quiet scenarios.

Comment thread test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsVbProj.cs
Comment thread test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs Outdated
@marcpopMSFT
Copy link
Copy Markdown
Member

Overlap with #53906. We should check tomorrow to see if there's anything either of us missed between the two.

- CS ItDefaultsToTheFirstUsableLaunchProfile: restore StdErr.BeEmpty()
  since --verbosity quiet suppresses the launch settings message
- VB ItDefaultsToTheFirstUsableLaunchProfile: fix path from Properties
  to My Project and assert message IS present on stderr

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs:424

  • In ItDefaultsToTheFirstUsableLaunchProfile, launchSettingsPath is still being computed but is no longer used after removing the assertion that referenced it. With TreatWarningsAsErrors enabled, this will fail the build; remove the unused local or use it in an assertion (e.g., against stderr) as intended.
            cmd.Should().Pass()
                .And.HaveStdOutContaining("First");

            cmd.StdErr.Should().BeEmpty();
        }

Comment thread test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs Outdated
Comment thread test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs
Copilot and others added 2 commits April 16, 2026 00:05
Replace all hardcoded 'Using launch settings from' checks with
string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath)
for proper localization support and stronger assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MichaelSimons
Copy link
Copy Markdown
Member Author

/ba-g The failing container tests are tracked with #53918. The failing RunFileTests_CscOnlyAndApi.CscOnly_SpacesInPath test is tracked with #53869

@MichaelSimons MichaelSimons merged commit 3dd3634 into main Apr 16, 2026
18 of 24 checks passed
@MichaelSimons MichaelSimons deleted the fix/update-run-tests-for-stderr-launch-settings branch April 16, 2026 16:27
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