WPF 触摸应用程序(部分)在 .NET Framework 4.7 上冻结 [英] WPF touch application (partially) freezes on .NET Framework 4.7

查看:65
本文介绍了WPF 触摸应用程序(部分)在 .NET Framework 4.7 上冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新

微软承认这个问题:

Gepost 门 Microsoft op 13/10/2017 om 11:38

Gepost door Microsoft op 13/10/2017 om 11:38

感谢您报告此事.我们已意识到此问题,并将在 .NET 的未来版本中修复它.还有一个相关问题正在服务修复中发布,这将大大降低遇到此问题的可能性.这将很快得到维修.

Thank you for reporting this. We are aware of this issue and are fixing it in a future version of .NET. There is also a related issue that is being released in a servicing fix that will drastically reduce the possibility of hitting this problem. This will be serviced relatively soon.

问题

我们的 WPF 应用程序正在使用触控(无触控笔)的平板电脑上使用,并且在安装 .NET Framework 4.7 后我们遇到了问题.使用应用程序一段时间后可能会出现两种情况:应用程序完全冻结并必须重新启动,或者 PopupWindow 元素中的所有触摸功能都被禁用.两者有很大的不同,但我相信原因是一样的.

Our WPF application is being used on tablets using touch (no stylus) and we are experiencing issues after the installation of .NET Framework 4.7. Two scenarios can occur after using the application for a while: either the application freezes completely and has to be restarted or all touch functionality in Popup or Window elements is disabled. There is quite a difference between the two but I believe the cause is the same.

场景 1:完全冻结

  • 应用程序变得完全没有响应,必须使用任务管理器关闭应用程序
  • 不能使用触摸或鼠标
  • 有时会在应用程序挂起之前抛出以下错误:

索引超出数组范围.

这是堆栈跟踪:

   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Windows.Input.StylusWisp.WispLogic.CoalesceAndQueueStylusEvent(RawStylusInputReport inputReport)
   at System.Windows.Input.StylusWisp.WispLogic.ProcessSystemEvent(PenContext penContext, Int32 tabletDeviceId, Int32 stylusDeviceId, Int32 timestamp, SystemGesture systemGesture, Int32 gestureX, Int32 gestureY, Int32 buttonState, PresentationSource inputSource)
   at System.Windows.Input.PenContext.FireSystemGesture(Int32 stylusPointerId, Int32 timestamp)
   at System.Windows.Input.PenThreadWorker.FireEvent(PenContext penContext, Int32 evt, Int32 stylusPointerId, Int32 cPackets, Int32 cbPacket, IntPtr pPackets)
   at System.Windows.Input.PenThreadWorker.ThreadProc()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart() 

场景 2:部分冻结

  • 主窗口仍然响应(通过鼠标和触摸),但任何覆盖"内容(模态对话框、WindowDatePicker 中的 Popup 元素code>, ComboBox, ...) 不响应点击.必须重新启动应用才能重新启用触控.
  • 鼠标仍可用于叠加"元素.
  • The main window is still responsive (by mouse and touch) but any 'overlay' content (Modal Dialog, Window, Popup element from DatePicker, ComboBox, ...) doesn't respond to tapping. The application must be restarted to reenable touch.
  • Mouse can still be used in 'overlay' elements.

这个问题也有详细说明这里.问题发生后的行为视频可以在此处.

This issue is also explained in detail here. A video of the behavior after the issue occurs can be found here.

附加信息

  • 可以在不同类型的平板电脑和 Windows 模拟器上模拟这两种场景,混合使用 Windows 8.1 和 Windows 10.
  • 删除 .NET Framework 4.7 后问题已解决
  • 场景 2 可以通过用多个手指快速点击某些 ComboBox 元素来轻松重现.几分钟后,弹出窗口不再响应触摸.
  • 场景 1 更难模拟并且随机发生.
  • Both scenarios can be simulated on different types of tablets and also on the Windows Simulator, using a mix of Windows 8.1 and Windows 10.
  • The issues are fixed when removing .NET Framework 4.7
  • Scenario 2 can be easily reproduced by quickly tapping some ComboBox elements with multiple fingers. After a few minutes, the popup is no longer responsive to touch.
  • Scenario 1 is harder to simulate and occurs randomly.

原因

这个问题似乎与 StylusWisp 代码有关.我想它会突然失败并且在那之后变得无法使用.

The issue seems to have something to do with the StylusWisp code. I guess it suddenly fails and becomes unusable after that point.

使用 DisableWPFTabletSupportDisableStylusAndTouchSupport,问题消失.但是,任何带有 PanningMode=Both"ScrollViewer 都不能再滑动滚动了.

When disabling the Stylus support by either using DisableWPFTabletSupport or DisableStylusAndTouchSupport, the issue disappears. However, any ScrollViewer with PanningMode="Both" can't be swipe scrolled anymore.

解决方案?

已向 Microsoft 报告了类似问题.由于还没有太多支持,修复可能需要一段时间.与此同时,我正在为这个问题寻找一种解决方案,该解决方案不涉及禁用 .NET Framework 4.7 并且保持原始触摸支持完整.有没有人有同样的问题和更好的解决方案?

A similar issue has been reported to Microsoft. Since there is not much support yet, a fix might take a while. In the meantime I'm looking for a solution for this issue that doesn't involve disabling the .NET Framework 4.7 and that keeps the original touch support intact. Does anyone have the same issues and a better solution?

推荐答案

安装 .NET Framework 4.7.1 似乎解决了这个问题..NET Framework 4.7.1 也包含在自 10 月开始推出的 Windows 10 Fall Creators Update 中.

Installing the .NET Framework 4.7.1 seems to fix the issue. The .NET Framework 4.7.1 is also included in the Windows 10 Fall Creators Update which has started rolling out since October.

这篇关于WPF 触摸应用程序(部分)在 .NET Framework 4.7 上冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆