Port fix for VSP floating-point hang from 4.8 #4979
Merged
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.
Addresses Issue #4978. This is a port of a servicing fix in .NET 4.7-4.8.
Description
The hang is due to floating-point drift. After any scroll, VSP runs logic to verify that it scrolled to the right place (it can be wrong due to new information discovered while de-virtualizing). There's a special case when the scroll reaches the end of the data, comparing the actual offset to the maximum (extent - viewport height). This uses the strict test DoubleUtil.AreClose(actual, maximum), which tolerates floating-point drift of 10^-16 pixel. But the difference in the repro is 10^-14 pixel, so the test fails.
Prior to the 2020-08 update, this would have merely triggered a Debug.Assert, invisible to customers. With the update, it now requests a re-measure, fixing a bug that arose when the numbers were legitimately different. But when the numbers are so close and layout rounding is enabled, the re-measure just ends up in the same situation, and the app hangs.
The fix is to use the looser test LayoutDoubleUtil.AreClose(actual, maximum), which tolerates floating-point drift of 10^-6 pixel.
Customer Impact
Hang while scrolling.
Regression
Exposed by PR #3564.
Testing
Ad-hoc with customer scenarios.
Standard regression testing.
Risk
Low. Straightforward port of .NETFx fix that was released earlier this year.