我们的WPF程序基于.NET 3.5开发,是一个零售收银程序,在部分电脑(XP和windows7)上有时会出现无限弹窗,窗口提示:已添加了具有相同键的项
捕获的日志显示如下:
未捕获的UI异常: 在 System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
在 System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
在 System.Collections.Generic.Dictionary`2..ctor(IDictionary`2 dictionary, IEqualityComparer`1 comparer)
在 Microsoft.Windows.Automation.Peers.DataGridAutomationPeer.GetItemPeers()
在 Microsoft.Windows.Automation.Peers.DataGridAutomationPeer.GetChildrenCore()
在 System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()
在 System.Windows.Automation.Peers.AutomationPeer.UpdateChildren()
在 System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
在 System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
在 System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
在 System.Windows.ContextLayoutManager.fireAutomationEvents()
在 System.Windows.ContextLayoutManager.UpdateLayout()
在 System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
在 System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
在 System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
在 System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
在 System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
这个提示有时会不一样,有时提示"对 automation peer API的递归调用无效" ,有时提示"无法在正在进行内容生成时调用 StartAt",
但基本都和System.Windows.Automation.Peers.AutomationPeer相关, 网上搜索说是和 WPFToolkit 这个组件有关,这个第三方组件我们的版本是 3.5.50211.1, 不知道其他社区朋友有没有遇到过这个问题?