Fix measuring passes in AdornerLayer of the underlying Adorner elements #10657
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #10640
Description
Marks
AdornerLayer
dirty when any of theAdorners
is dirty and forces a measure pass so that the position is updated.Due to the aggressive performance optimization to only re-render when size/position changes (including transforms),
a case such as this has been overlooked so the position of the respective Adorner's is wrong while all flags are correct.
This could have been workarounded via synchronous
UpdateLayout
pass called by the user or invoking visual re-invalidation but due to its asynchronous nature this would only work the second time around.I have also removed the redundant assigment of cached
RenderSize
/Transform
and in-lined the two calls instead.This shall not add any unnecessary overhead according to my testing.
Customer Impact
If the fix is not taken, customers will continue to observe unwanted behaviour and will be required to use computionally expensive and synchronous updates to receive the correct position for Adorners upon adorned
UIElement
changes.Regression
Not according to my tests, this seems to be present both on
.NET Core
andNETFX
.Testing
Local build, repro tests from #10640, tests with adorners.
Risk
Medium, it would be beneficial to test more real-life examples of adorners.
Microsoft Reviewers: Open in CodeFlow