Skip to content

Fix duplicate issue number crash breaking all Windows UI tests#34991

Merged
jfversluis merged 1 commit intonet11.0from
fix/toolbar-badge-duplicate-issue-number
Apr 16, 2026
Merged

Fix duplicate issue number crash breaking all Windows UI tests#34991
jfversluis merged 1 commit intonet11.0from
fix/toolbar-badge-duplicate-issue-number

Conversation

@jfversluis
Copy link
Copy Markdown
Member

Problem

PR #34669 (ToolbarItem Badge Support) added Issue8305_Toolbar.cs with [Issue(IssueTracker.Github, 8305, ...)], but Issue8305.cs (Shell Badge, from PR #34659) already uses issue number 8305. Both generated the same DisplayName = "G8305", causing VerifyNoDuplicates() in TestCases.cs to throw NotSupportedException at app startup, crashing the entire HostApp and failing ALL Windows UI tests (not just toolbar tests).

This crash has been present since build 1371858 (PR #34669 merge). The follow-up PR #34963 fixed nullable warnings but did not address this crash.

Root Cause

TestCases.cs:VerifyNoDuplicates() (line 161-175) uses a HashSet to check for duplicate DisplayName values. When two [Issue] attributes share the same tracker and number with default issueTestNumber=0, they produce identical display names, triggering the crash.

Fix

  1. Add issueTestNumber: 1 to Issue8305_Toolbar's [Issue] attribute, producing unique DisplayName = "G8305 (1)" instead of duplicate "G8305"
  2. Replace non-existent icon images (envelope.png, bell.png, cart.png) with images that exist in HostApp resources (bank.png, calculator.png, shopping_cart.png)

Verification

  • Both Controls.TestCases.HostApp (Windows TFM) and Controls.TestCases.Shared.Tests build successfully
  • The issueTestNumber pattern is well-established (used by Issue11769, Issue13126_2, Issue1583_1, Issue28986_Border, and others)

PR #34669 added Issue8305_Toolbar.cs with [Issue(IssueTracker.Github, 8305, ...)]
but Issue8305.cs (Shell Badge, from PR #34659) already uses the same issue number.
Both generated DisplayName 'G8305', causing VerifyNoDuplicates() in TestCases.cs
to throw NotSupportedException on app startup, crashing ALL UI tests.

Fix:
- Add issueTestNumber: 1 to Issue8305_Toolbar's [Issue] attribute to produce
  unique DisplayName 'G8305 (1)'
- Replace non-existent icon images (envelope.png, bell.png, cart.png) with
  images that exist in HostApp resources (bank.png, calculator.png,
  shopping_cart.png)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 07:19
@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/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34991

Or

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

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

Resolves a HostApp startup crash that was breaking all Windows UI tests by ensuring the Issue8305_Toolbar test case has a unique issue display name and only references image assets that exist in HostApp resources.

Changes:

  • Adds issueTestNumber: 1 to Issue8305_Toolbar’s [Issue] attribute to avoid duplicate DisplayName collisions (e.g., G8305).
  • Replaces non-existent toolbar icon filenames with existing HostApp image resources (bank.png, calculator.png, shopping_cart.png).

@jfversluis
Copy link
Copy Markdown
Member Author

/azp run maui-pr-uitests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants