Skip to content

fix(safearea): accept static lambdas in CreateWeakHandler debug assert (backport #1655) - #1686

Merged
kazo0 merged 1 commit into
servicing/10.0from
dev/sb/20261027/backport-10.0
Oct 28, 2026
Merged

kazo0 merged 1 commit into
servicing/10.0from
dev/sb/20261027/backport-10.0

Conversation

@kazo0

@kazo0 kazo0 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): backport of #1655 (regression from the #1602 fix, b2844ea)

PR Type

  • Bugfix

What is the current behavior?

In Debug builds, every app that loads a SafeArea fails an assertion at startup. The CreateWeakHandler assert requires Delegate.Target is null, but static lambdas compile to instance methods on the compiler's <>c singleton, so it fails for correct callers.

What is the new behavior?

IsNonCapturing(Delegate) accepts targets with no instance fields, so static lambdas pass. Closures and delegates bound to this still fail the assert. The commit is cherry-picked from 9918d84.

Conflict resolved

In SafeArea.cs, I kept the comment explaining why System.Diagnostics.Debug is fully qualified. servicing/10.0 still builds native net*-android, where an unqualified Debug binds to ViewGroup.Debug(int). main dropped that comment after its Uno 7 Skia port.

This PR first included #1679 as well. #1680 has since landed #1679 on servicing/10.0 with the same resolution, so this PR was rebased down to #1655.

Not backported

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

The rebased branch is identical to the tree validated locally on macOS before the rebase (servicing/10.0 with #1679 resolved the same way as #1680, plus this commit):

  • Uno.Toolkit.WinUI builds for net9.0-android and net9.0-ios (native) in Debug and Release with 0 errors, with TreatWarningsAsErrors
  • MaterialSampleApp builds for net10.0-desktop in Release with 0 errors
  • The conflict-marker gate is clean
  • Runtime tests (desktop Release): 937 of 938 passed, 57 skipped, including WeakHandler_IsNonCapturing. The one failure, FlexPanelTests.When_UseLayoutRoundingTrue_ThenArrangeSnapsToPixelGrid, also fails on unmodified servicing/10.0 on this Mac. It expects 34.0 but gets 33.5 at the display's 2× scale, so it depends on the machine and not on this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PZQ75jvGWnf3XhqeenkJ9X

@kazo0 kazo0 changed the title fix(safearea): backport #1655 and #1679 to servicing/10.0 fix: backport #1655 and #1679 to servicing/10.0 Oct 28, 2026
@kazo0
kazo0 enabled auto-merge (squash) October 28, 2026 17:33
…t (backport #1655)

- Cherry-picked from 9918d84
- Keeps the comment on why Debug is fully qualified: servicing/10.0 still builds native net*-android

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PZQ75jvGWnf3XhqeenkJ9X
@kazo0
kazo0 force-pushed the dev/sb/20261027/backport-10.0 branch from aa7d6df to 7f60bf5 Compare October 28, 2026 17:33
@kazo0 kazo0 changed the title fix: backport #1655 and #1679 to servicing/10.0 fix(safearea): accept static lambdas in CreateWeakHandler debug assert (backport #1655) Oct 28, 2026
@kazo0
kazo0 merged commit af20b30 into servicing/10.0 Oct 28, 2026
19 checks passed
@kazo0
kazo0 deleted the dev/sb/20261027/backport-10.0 branch October 28, 2026 17:58
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.

3 participants