Port IME/databinding fix from 4.8. #5840
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 #5444
This is a port of a servicing fix in .NET 4.7-4.8.
Description
A binding on TextBox.Text defers two kinds of work when an IME composition is in progress on the TextBox:
The bug occurs when the IME starts a new composition before the previous composition's type 2 work happens. This yields a situation where two tasks are deferred: the older composition's type 2 task and the newer composition's type 1 task. The type 2 task happens first, overwriting the text change that the type 1 task is supposed to handle. This confusion of state leads to exceptions (caught and hidden from the IME, but visible in the debugger), and unexpected content entered into the TextBox.
Fixed by cancelling any pending type 2 work when new type 1 work is needed.
Customer Impact
Input with certain IMEs (e.g. MS Quick) is broken.
Regression
No.
Testing
Ad-hoc around customer scenario.
Standard regression testing.
Risk
Low. Port of a .NETFx servicing fix released earlier this year.