Skip to content

Fix PopConfirm crash when Placement is PlacementMode.Custom - #1072

Merged
rabbitism merged 3 commits into
mainfrom
copilot/fix-popconfirm-placement-issue
Sep 4, 2026
Merged

Fix PopConfirm crash when Placement is PlacementMode.Custom#1072
rabbitism merged 3 commits into
mainfrom
copilot/fix-popconfirm-placement-issue

Conversation

Copilot AI commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Setting PopConfirm.Placement to PlacementMode.Custom crashed the application, since Custom requires a positioning delegate that PopConfirm does not supply.

Changes

  • PopConfirm.PlacementProperty: added a coerce callback that maps PlacementMode.Custom to PlacementMode.Center, leaving all other values untouched.
public static readonly StyledProperty<PlacementMode> PlacementProperty =
    Popup.PlacementProperty.AddOwner<PopConfirm>(
        new StyledPropertyMetadata<PlacementMode>(
            coerce: static (_, value) => value is PlacementMode.Custom ? PlacementMode.Center : value));
  • Tests: added headless tests covering that Custom coerces to Center and non-Custom values (e.g. Top) are preserved.

Note

The test suite could not be executed in this environment because the Avalonia nightly NuGet feed is unreachable (NU1301), blocking package restore.

Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix crash issue in PopConfirm when placement is custom Fix PopConfirm crash when Placement is PlacementMode.Custom Sep 4, 2026
Copilot AI requested a review from rabbitism September 4, 2026 06:01
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit f82c4f0. ± Comparison against base commit b910a09.

♻️ This comment has been updated with latest results.

@rabbitism
rabbitism marked this pull request as ready for review September 4, 2026 14:26
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Ursa 47% 35% 11142
Ursa.Themes.Semi 62% 66% 2887
Summary 55% (18665 / 34043) 37% (3434 / 9250) 14029

@rabbitism
rabbitism merged commit 7438b21 into main Sep 4, 2026
4 checks passed
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.

PopConfirm 的 Placement = PlacementMode.Custom 时会闪退

2 participants