Skip to content

Fix Outerloop dashboard test: Kestrel rejects dynamic-port bind on "localhost" - #18246

Closed
Ankit Jain (radical) wants to merge 1 commit into
microsoft:mainfrom
radical:radical/fix-dashboard-outerloop-localhost-port
Closed

Fix Outerloop dashboard test: Kestrel rejects dynamic-port bind on "localhost"#18246
Ankit Jain (radical) wants to merge 1 commit into
microsoft:mainfrom
radical:radical/fix-dashboard-outerloop-localhost-port

Conversation

@radical

Copy link
Copy Markdown
Member

BrowserToken_QueryStringToken_HttpsThenHttp_WebKit_Success fails every scheduled Outerloop run — its class fixture throws before any test body runs:

Class fixture type 'BrowserTokenDashboardServerWithHttpAndHttpsFixture' threw in InitializeAsync
---- System.InvalidOperationException : Dynamic port binding is not supported when binding to localhost. You must either bind to 127.0.0.1:0 or [::1]:0, or both.

Root cause. The fixture binds the dashboard frontend to https://localhost:0;http://localhost:0. Kestrel doesn't support dynamic-port (:0) binding on the localhost hostname — the constraint is hostname-based, independent of scheme. The base DashboardServerFixture already binds 127.0.0.1:0 and works.

Fix. Bind to https://127.0.0.1:0;http://127.0.0.1:0. The WebKit test navigates to the endpoint's resolved address with IgnoreHTTPSErrors, so the loopback IP is fine.

Verified locally: a minimal Kestrel app reproduces the exact exception on localhost:0 and binds successfully on 127.0.0.1:0; the test project compiles. The Playwright test itself runs only in the browser-enabled Outerloop environment.

Broken since the fixture was added in #17368. Surfaced by workflow-health report #18223.

Refs #18223

The BrowserTokenDashboardServerWithHttpAndHttpsFixture bound the dashboard
frontend to "https://localhost:0;http://localhost:0". Kestrel rejects
dynamic-port (":0") binding on the "localhost" hostname:

  System.InvalidOperationException: Dynamic port binding is not supported
  when binding to localhost. You must either bind to 127.0.0.1:0 or
  [::1]:0, or both.

So the fixture threw in InitializeAsync and
BrowserToken_QueryStringToken_HttpsThenHttp_WebKit_Success failed every
scheduled Outerloop run. Bind to 127.0.0.1:0 instead, matching the base
DashboardServerFixture. The WebKit test navigates to the resolved address
with IgnoreHTTPSErrors, so the loopback IP is fine.

Broken since the fixture was introduced in microsoft#17368.

Refs microsoft#18223

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 16, 2026 18:25
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18246

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18246"

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 a broken Outerloop dashboard Playwright test (BrowserToken_QueryStringToken_HttpsThenHttp_WebKit_Success) that has been failing on every scheduled run. The fixture was binding Kestrel to localhost:0, which Kestrel explicitly rejects for dynamic port allocation — the fix uses 127.0.0.1:0 instead, consistent with the base DashboardServerFixture.

Changes:

  • Replace https://localhost:0;http://localhost:0 with https://127.0.0.1:0;http://127.0.0.1:0 in the test fixture, and add a comment explaining the Kestrel constraint.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@radical

Copy link
Copy Markdown
Member Author

Consolidating the unapproved Outerloop test fixes into a single PR: #18250. Closing in favor of that one (same change, preserved authorship).

@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.5 milestone Jun 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

automated Opened by bots or tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants