gpt4 book ai didi

c# - WPF 触控应用程序(部分)在 .NET Framework 4.7 上卡住

转载 作者:太空狗 更新时间:2023-10-29 20:32:59 30 4
gpt4 key购买 nike

更新

Microsoft acknowledged the issue :

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

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 后遇到问题。使用应用程序一段时间后可能会发生两种情况:应用程序完全卡住并必须重新启动,或者 Popup 中的所有触摸功能。或 Window元素被禁用。两者之间有很大的不同,但我相信原因是一样的。

场景一:完全卡住

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

Index was outside the bounds of the array.

这是堆栈跟踪:

   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()

场景二:部分卡住

  • 主窗口仍然响应(通过鼠标和触摸)但任何“覆盖”内容(模式对话框、WindowPopup 来自DatePickerComboBox 的元素,...)没有响应攻丝。必须重新启动应用程序才能重新启用触摸。
  • 鼠标仍然可以在“overlay”元素中使用。

这个问题也有详细解释here .可以找到问题发生后的行为视频here .

附加信息

  • 这两种情况都可以在不同类型的平板电脑上进行模拟,也可以在 Windows 模拟器上混合使用 Windows 8.1 和 Windows 10。
  • 删除 .NET Framework 4.7 时问题已修复
  • 场景 2 可以通过快速点击一些 ComboBox 来轻松重现。具有多个手指的元素。几分钟后,弹出窗口不再响应触摸。
  • 场景 1 更难模拟并且随机发生。

原因

这个问题似乎与 StylusWisp 代码有关。我猜它突然失败,在那之后变得无法使用。

使用 DisableWPFTabletSupport 禁用手写笔支持时或 DisableStylusAndTouchSupport ,问题消失。但是,任何 ScrollViewerPanningMode="Both"不能再滑动滚动了。

解决方案?

A similar issue已报告给微软。由于还没有太多支持,修复可能需要一段时间。与此同时,我正在寻找针对此问题的解决方案,该解决方案不涉及禁用 .NET Framework 4.7 并且保持完整的原始触摸支持。有没有人有同样的问题和更好的解决方案?

最佳答案

为什么它在 Windows10 Creators Update 的 .NET Framework 4.7 中中断?

我的 friend lsjhttps://referencesource.microsoft.com 下载源代码并找到 .NET 4.7 for Windows 10 Creators Update没有给 WispLogic.CoalesceAndQueueStylusEvent 添加锁,另一个添加锁。

所以它只在 .NET Framework 4.7 for Windows10 Creators Update 中中断。和 .NET Framework 4.7 RTM将锁添加到 WispLogic.CoalesceAndQueueStylusEvent 并修复它。

哪个版本加锁?

哪个版本解除锁定?

有趣的是.NET 4.7 RTM将锁添加到 WispLogic.CoalesceAndQueueStylusEvent.NET 4.7.1 Downlevel删除它。

.NET 4.7.2 for Windows 10 April 2018 Creators Update是第一个添加锁的版本,它似乎在 .NET 4.7.2 中修复,但在 .NET 4.7.1 中未修复

关于c# - WPF 触控应用程序(部分)在 .NET Framework 4.7 上卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46049673/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com