[PresentationFramework] Tooltip safe-area handling can throw during hover transitions
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
# [PresentationFramework] Tooltip safe-area handling can throw during hover transitions
## Summary
Tooltip processing can throw when pointer movement intersects with a tooltip whose underlying window/source is disposed during hover transitions.
## Observed behavior
- In tooltip-heavy UI paths, moving the mouse near or over tooltip boundaries can trigger an exception in tooltip coordinate processing.
- The failure is intermittent and timing-sensitive, so it can be difficult to reproduce deterministically.
## Repro notes
1. Run a WPF app with controls that frequently show/hide tooltips.
2. Move the mouse quickly across controls while tooltips are opening/closing.
3. Observe occasional exceptions originating from tooltip safe-area coordinate conversion paths.
## Impact
- This can crash or destabilize applications during normal tooltip interaction.
- Apps with dense UI surfaces and frequent tooltip activity are more likely to be affected.
## Expected behavior
Tooltip transitions should remain safe even if the tooltip's underlying source/window is disposed mid-flow.
## Actual behavior
The tooltip path may still use a previously captured safe-area source that has already been disposed, causing coordinate conversion to fail and throw.
## Suspected root cause
Safe-area checks only validated presence (`SafeArea != null`) and did not validate whether the underlying `PresentationSource` was still alive when used.
## Proposed fix direction
- Introduce a validity gate for safe-area usage, not just null checks.
- Treat disposed safe-area sources as invalid and fall back to behavior equivalent to "no safe area".
- Route tooltip mouse-trigger logic and safe-area exit checks through the new validity gate.
- Expose convex hull/source validity in a minimal internal property used by tooltip logic.
Contributor guide
Assessment
This issue has not been assessed yet.