Skip to content

Fix AspireHostLauncher not launching the Aspire host#53877

Merged
tmat merged 2 commits intomainfrom
dev/karolz/aspire-watch-host
Apr 15, 2026
Merged

Fix AspireHostLauncher not launching the Aspire host#53877
tmat merged 2 commits intomainfrom
dev/karolz/aspire-watch-host

Conversation

@karolz-ms
Copy link
Copy Markdown
Member

No description provided.

@karolz-ms karolz-ms requested review from a team and tmat as code owners April 15, 2026 01:10
Copilot AI review requested due to automatic review settings April 15, 2026 01:10
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

This PR fixes AspireHostLauncher so the Aspire host project is actually launched (by providing MainProjectOptions to the watcher), and strengthens tests to detect regressions.

Changes:

  • Pass host ProjectOptions into DotNetWatchContext.MainProjectOptions when launching the Aspire watcher.
  • Adjust AspireHostLauncher/tests to use the new project-options flow (GetHostProjectOptions wrapper for testing).
  • Update the Aspire launcher end-to-end test to assert the host app outputs Started.

Reviewed changes

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

File Description
test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireLauncherTests.cs Adds a runtime-output assertion (Started) to confirm the host app is actually launched.
test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireHostLauncherTests.cs Updates tests to call the new host project-options accessor.
src/Dotnet.Watch/Watch.Aspire/Server/AspireWatcherLauncher.cs Wires MainProjectOptions from an overridable GetProjectOptions() to enable main-project launching.
src/Dotnet.Watch/Watch.Aspire/Host/AspireHostLauncher.cs Implements GetProjectOptions() override so the host launch supplies MainProjectOptions.
Comments suppressed due to low confidence (1)

test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireHostLauncherTests.cs:51

  • GetHostProjectOptions() returns a non-null ProjectOptions, so the null-forgiving operator (!) is redundant here (and can hide nullability issues if the signature changes later). Consider removing the ! (and similarly in the other occurrences in this file once the underlying return type is non-null).
        var options = launcher.GetHostProjectOptions()!;

        AssertCommonProperties(options, launcher);
        Assert.False(options.LaunchProfileName.HasValue);
        AssertEx.SequenceEqual(["--project", "myapp.csproj", "--no-launch-profile"], options.CommandArguments);

Comment thread src/Dotnet.Watch/Watch.Aspire/Host/AspireHostLauncher.cs Outdated
@tmat
Copy link
Copy Markdown
Member

tmat commented Apr 15, 2026

/ba-g Unrelated issues.

Copilot analysis:

The CI has two distinct categories of test failures, all across 5 legs (Windows/Linux/macOS):

  1. ✅ Known Issue — RunFileTests csc-only binary log warning

Tracked by #53869 (#53869) ([Known Build Error]). Affects
RunFileTests_BuildCommands.LaunchProfile, RunFileTests_BuildOptions.WorkingDirectory,
RunFileTests_CscOnlyAndApi.CscOnly. Reproduces on main.

  1. ❌ NOT tracked — "Using launch settings" stderr failures

These tests fail because dotnet run now outputs "Using launch settings from ...launchSettings.json..." to stderr,
but the tests assert empty/no stderr:

  • GivenDotnetRunRunsVbproj.ItUsesLaunchProfileOfTheSpecifiedName("Second")
  • GivenDotnetRunRunsVbproj.ItUsesLaunchProfileOfTheSpecifiedName("sEcoND")
  • GivenDotnetRunRunsVbproj.ItDefaultsToTheFirstUsableLaunchProfile
  • RunCommandTests.EnvironmentVariableExpansion_Project

These are not tracked by any existing [Known Build Error] issue in dotnet/sdk. They appear to be a pre-existing
issue on main (not caused by PR #53877's Aspire watch changes), since the "Using launch settings" message is
unrelated to the 4 files changed in this PR.

@tmat tmat merged commit 16cbfb3 into main Apr 15, 2026
18 of 24 checks passed
@tmat tmat deleted the dev/karolz/aspire-watch-host branch April 15, 2026 05:20
@tmat
Copy link
Copy Markdown
Member

tmat commented Apr 15, 2026

/backport to release/10.0.3xx

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.3xx (link to workflow run)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants