Repository navigation
Conversation
…idOperationException dotnet#6829
| _transformToDeviceMatrices[hwndSource.CompositionTarget.CurrentDpiScale] = hwndSource.CompositionTarget.TransformToDevice; | ||
| Debug.Assert(_transformToDeviceMatrices[hwndSource.CompositionTarget.CurrentDpiScale].HasInverse); | ||
| DpiScale2 currentDpiScale = compositionTarget.CurrentDpiScale; | ||
| toDevice.Scale(currentDpiScale.DpiScaleX, currentDpiScale.DpiScaleY); |
There was a problem hiding this comment.
is the transform not cached?
There was a problem hiding this comment.
@miloush Do you think cache is fast than calculation? Thank you. I means that we should handle the cross thread issues when we cache it.
|
I am wondering why is the class a |
|
Hey @lindexi , Here is the code I am using: |
|
@rchauhan18 Do you change the DPI? Please make sure the And could you debug and add the break point in |
|
@lindexi Yes, I am able to add a break point in |
|
@rchauhan18 How about multi-screen with different DPI configuration? Moving the app between the two screens. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
@LickBag Could you test my custom WPF version?
<PackageVersion Include="dotnetCampus.WPF.Resource" Version="6.0.4-alpha07-test06" />
|
…idOperationException (dotnet#6840) Upstream-PR: dotnet#6840 Upstream-PR-Head: 557a8d1
cherry-pick: Fix get TransformToDevice in Stylus Input thread will throw the InvalidOperationException (upstream dotnet#6840)

Fixes #6829
Description
See #6829
The
Stylus Inputthread will enter the GetAndCacheTransformToDeviceMatrix method to get the Matrix. But after we change the DPI, theStylus Inputthread can not find the Matrix in_transformToDeviceMatrices. It means that theStylus Inputthread should get the Matrix fromHwndTarget.TransformToDeviceproperty which only allow get from UI Thread.I fix it by dispatch to UI Thread. To improve performance, we will calculate it
CurrentDpiScaleproperty.Customer Impact
Fix tocuh in Window with StylusPlugIn may throw InvalidOperationException
Regression
Yes, see #2891
Testing
Just CI
And I pick the code to dotnet-campus/DotNetCampus.CustomWpf#21 to build the private version to test it by my application.
Risk
Low.
Microsoft Reviewers: Open in CodeFlow