Skip to content

Fix AngleSharp warning in dashboard component tests - #20360

Merged
James Newton-King (JamesNK) merged 2 commits into
mainfrom
jamesnk/fix-dashboard-anglesharp-warning
Sep 23, 2026
Merged

James Newton-King (JamesNK) merged 2 commits into
mainfrom
jamesnk/fix-dashboard-anglesharp-warning

Conversation

@JamesNK

Copy link
Copy Markdown
Member

Description

Building and running dashboard component tests reports NU1902 because bUnit 1.36.0 brings in AngleSharp 1.1.2, which is affected by GHSA-pgww-w46g-26qg. Upgrade bUnit to 2.11.3 so the tests resolve AngleSharp 1.8.1 without suppressing the advisory.

  • Migrate component tests to bUnit 2 APIs for contexts, rendering, rendered components, authorization, and asynchronous component disposal.
  • Override the central .NET 10 pins for Configuration.EnvironmentVariables and FileSystemGlobbing only in the component test project. bUnit's .NET 11 WebAssembly dependencies require newer versions; without the overrides, restore fails with NU1109. Comments explain their scope and removal condition.
  • No production dashboard behavior or public API changes.

A direct AngleSharp 1.5.0 pin with bUnit 1.36.0 was tested first, but caused MissingMethodException failures due to binary incompatibility. Upgrading bUnit avoids that incompatibility.

Validation

  • Dashboard tests: 1,892 passed, 0 failed.
  • Dashboard component tests: 566 passed, 0 failed.
  • Both suites exclude quarantined and outerloop tests.
  • Restore no longer reports the AngleSharp advisory.
  • Component validation used -p:WarningsNotAsErrors=CA1826 for two existing analyzer diagnostics in MobileNavMenuTests. Those diagnostics remain unchanged; no analyzer suppression was added to the project.
  • git diff --check passes.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Upgrade bUnit and migrate component tests to its supported APIs. Scope required .NET 11 dependency overrides to the component test project.

Co-authored-by: Copilot <[email protected]>
@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 -- 20360

Or

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

@github-actions

This comment has been minimized.

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.

Copilot review overview

🔵 Needs a closer look

The obsolete reflection-based bUnit handler workaround must be removed or concretely justified.

Review effort: Balanced
Findings: None

What changed in this PR

Upgrades dashboard component tests to bUnit 2.11.3, resolving the AngleSharp security advisory and migrating affected test APIs.

Changes:

  • Migrates rendering, context, authorization, and disposal APIs to bUnit 2.
  • Adds scoped .NET 11 dependency overrides required for restore.
  • Updates shared helpers and rendered-component types.
File Description
tests/​Directory.Packages.props Upgrades bUnit; reassess the now-obsolete private-handler workaround.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​TestJSObjectReference.cs Uses BunitContext.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​TerminalSetupHelpers.cs Migrates terminal helpers.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​StructuredLogsSetupHelpers.cs Updates context type.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​ResourceSetupHelpers.cs Updates resource helpers.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​MetricsSetupHelpers.cs Updates metrics helpers.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​LayoutSetupHelpers.cs Updates layout helpers.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​InteractionsSetupHelpers.cs Migrates rendered-component types.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​FluentUISetupHelpers.cs Migrates Fluent UI helpers.
tests/​Aspire.Dashboard.Components.Tests/​Shared/​DashboardPageTestContext.cs Adopts BunitContext; obsolete reflection workaround must be removed or justified.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​TracesTests.cs Migrates render calls.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​TraceDetailsTests.cs Migrates rendering and disposal.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​TerminalWindowTests.cs Migrates terminal-window tests.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​StructuredLogsTests.cs Migrates structured-log rendering.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​ResourcesTests.cs Migrates resource tests.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​MetricsTests.cs Migrates metrics tests.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​ConsoleLogsTests.cs Migrates console-log tests.
tests/​Aspire.Dashboard.Components.Tests/​Pages/​ConsoleLogsTerminalTests.cs Migrates terminal log tests.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​TerminalDockWindowTrackingTests.cs Migrates window-tracking tests.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​TerminalDockTests.cs Migrates terminal-dock tests.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​TerminalDockTelemetryTests.cs Migrates telemetry rendering.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​TerminalDockInitializationTests.cs Migrates initialization tests.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​ResourceServiceConnectionProviderTests.cs Migrates provider rendering.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​MobileNavMenuTests.cs Migrates navigation rendering.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​MainLayoutTests.cs Migrates layout tests.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​MainLayoutTerminalTests.cs Migrates terminal-layout tests.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​DashboardDialogProviderTests.cs Migrates rendering and disposal.
tests/​Aspire.Dashboard.Components.Tests/​Interactions/​InteractionsProviderTests.Terminal.cs Migrates terminal interaction tests.
tests/​Aspire.Dashboard.Components.Tests/​Interactions/​InteractionsProviderTests.cs Migrates interaction tests.
tests/​Aspire.Dashboard.Components.Tests/​GridColumnManagerTests.cs Migrates grid rendering.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​SettingsDialogTests.cs Migrates settings-dialog tests.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​NotificationEntryComponentTests.cs Migrates notification rendering.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​ManageDataDialogTests.cs Migrates data-dialog tests.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​InteractionsTerminalDialogTests.cs Migrates host rerendering.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​InteractionsInputDialogTests.cs Updates rendered-component type.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​InteractionMessageBoxDialogTests.cs Migrates dialog-host rendering.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​HelpDialogTests.cs Migrates help-dialog rendering.
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​FilterDialogTests.cs Migrates filter-dialog tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​UserProfileTests.cs Migrates authorization and rendering APIs.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​UrlsColumnDisplayTests.cs Migrates URL-display tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​TotalItemsFooterTests.cs Migrates footer rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​TextVisualizerDialogTests.cs Migrates visualizer rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​TerminalWindowButtonTests.cs Migrates terminal-button tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​TerminalViewTests.cs Migrates terminal-view tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​StructuredLogDetailsTests.cs Migrates detail rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​ResourceSelectTests.cs Migrates resource-selector rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​ResourceDetailsTests.cs Migrates resource-detail tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​PlotlyChartTests.cs Migrates chart rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​LogViewerTests.cs Migrates log-viewer tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​GenAIVisualizerDialogTests.cs Migrates GenAI dialog rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​ChartFiltersTests.cs Migrates chart-filter rendering.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​AspirePropertyDetailsAccordionItemTests.cs Migrates accordion tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​AspireProgressRingTests.cs Migrates progress-ring tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​AspireMenuTests.cs Migrates menu tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​AspireMenuButtonTests.cs Migrates menu-button tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​AspireLogoTests.cs Adopts BunitContext and Render.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​AspireFluentDataGridTests.cs Migrates data-grid tests.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​ApplicationNameTests.cs Migrates application-name tests.
tests/​Aspire.Dashboard.Components.Tests/​Aspire.Dashboard.Components.Tests.csproj Adds scoped .NET 11 package overrides.
eng/​Versions.props Defines required .NET 11 package versions.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@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.

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.

Copilot review overview

🔵 Needs a closer look

The obsolete bUnit handler reflection workaround must be removed and its stale comment corrected.

Review effort: Balanced
Findings: None

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

Selects the full PR test matrix + all PR-gated jobs (ALL) — a rule matching 'eng/Versions.props' selects ALL


Selection computed for commit ddc3867.

@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.

@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.

@mitchdenny Mitch Denny (mitchdenny) left a comment

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.

Reviewed the full diff against main. The bUnit upgrade addresses the AngleSharp security advisory and the API migration is consistent across the component tests. No blocking correctness, security, performance, or test coverage issues found.

@JamesNK
James Newton-King (JamesNK) merged commit 456dc9e into main Sep 23, 2026
1243 of 1249 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Sep 23, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch taken: docs_optional → test_only (all changed files match tests/** plus a test-dependency version bump in eng/Versions.props; no production/src/ files were touched).

Triggered signals (2): pr_body_has_cli_flag_mention, pr_body_has_security_marker. Both are false positives from .pr-docs-check/signals.json evidence:

  • pr_body_has_cli_flag_mention matched generic PR-template checklist text ("...- git diff --check passes. Fixes # (issue) ## Checklist - Is this fe...") — not an actual CLI flag.
  • pr_body_has_security_marker matched the phrase "is affected by [GHSA-pgww-w46g-26qg]" — this refers to a NuGet security advisory for AngleSharp, a test-only transitive dependency pulled in by bUnit, used solely in Aspire.Dashboard.Components.Tests.

Changed-file evidence: all 60 changed files are either under tests/Aspire.Dashboard.Components.Tests/** (bUnit 1→2 API migration in test code), tests/Directory.Packages.props (bUnit/AngleSharp version bump), or eng/Versions.props (central version bump for test-only package overrides). Verified programmatically: 0 files outside tests/ and eng/Versions.props.

The PR body itself states: "No production dashboard behavior or public API changes." This is a test-infrastructure/dependency-hygiene fix (upgrading bUnit to resolve a transitive AngleSharp NuGet security advisory in dashboard component tests) with zero user-facing or public-API impact. No documentation update is warranted on microsoft/aspire.dev.

Jose Perez Rodriguez (joperezr) pushed a commit that referenced this pull request Sep 24, 2026
Backports #20360, #20341, and #20362 to release/13.6.

## Customer Impact

Dashboard users can encounter popups that are misaligned, overflow the
viewport, or disappear while metric dimensions update. Resource graph
context menus may not reopen immediately after dismissal, and terminal
auto-fit can move focus away from the active control.

## Testing

Validated on the release/13.6 backport branch: 570
Aspire.Dashboard.Components.Tests and 1,892 Aspire.Dashboard.Tests
passed, excluding quarantined and outerloop tests. The source changes
also include targeted Playwright coverage for resources, terminal,
navigation, authentication, accessibility, and popup behavior. `git diff
--check` passes.

## Risk

Medium. The production changes are localized to Dashboard popup, focus,
and component-state behavior with no public API changes, but this
combines three related changes and a broad component-test migration.

## Regression?

Yes — fixes Dashboard behavior and test regressions introduced by the
Fluent UI v5 migration.
David Pine (IEvangelist) pushed a commit that referenced this pull request Oct 1, 2026
Backports #20360, #20341, and #20362 to release/13.6.

## Customer Impact

Dashboard users can encounter popups that are misaligned, overflow the
viewport, or disappear while metric dimensions update. Resource graph
context menus may not reopen immediately after dismissal, and terminal
auto-fit can move focus away from the active control.

## Testing

Validated on the release/13.6 backport branch: 570
Aspire.Dashboard.Components.Tests and 1,892 Aspire.Dashboard.Tests
passed, excluding quarantined and outerloop tests. The source changes
also include targeted Playwright coverage for resources, terminal,
navigation, authentication, accessibility, and popup behavior. `git diff
--check` passes.

## Risk

Medium. The production changes are localized to Dashboard popup, focus,
and component-state behavior with no public API changes, but this
combines three related changes and a broad component-test migration.

## Regression?

Yes — fixes Dashboard behavior and test regressions introduced by the
Fluent UI v5 migration.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants