问题描述
我已经在.NET Framework 4.5.1上构建了WPF桌面应用程序.它通常"可以正常工作,但是在某些计算机上,在运行时将显示WPF数据网格时出现System.OutOfMemoryException.
I've built a WPF desktop application on .NET framework 4.5.1. It "usually" works fine, but, on certain machines, at runtime, a System.OutOfMemoryException when a WPF datagrid is going to be shown.
堆栈跟踪报告:
An error of type System.OutOfMemoryException occurred.
in System.Windows.Controls.ItemContainerGenerator.ContainerFromItem(Object item)
in Microsoft.Windows.Controls.DataGrid.TryFindCell(Object item, DataGridColumn column)
in Microsoft.Windows.Automation.Peers.DataGridCellItemAutomationPeer.get_OwningCellPeer()
in Microsoft.Windows.Automation.Peers.DataGridCellItemAutomationPeer.IsEnabledCore()
in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
in System.Windows.ContextLayoutManager.fireAutomationEvents()
in System.Windows.ContextLayoutManager.UpdateLayout()
in System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
in System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
in System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
in System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
in System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
in MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
非工作计算机为32位,Windows 7、2 GB RAM,.NET Framework 4.5.1..
Non-working machines are 32 bit, Windows 7, 2 GB of RAM, .NET framework 4.5.1.
我必须说,数据网格仅显示几行.我一直在网上寻找类似的错误,但是找不到任何合适的解决方案.
I must say that the datagrid only displays few rows.I've been looking for similar errors on the web, but I couldn't find any suitable solution.
有什么建议吗?
谢谢!
推荐答案
该问题原来与正在运行的帐户缺少某些特权有关.
The problem turned out to be related to some missing privilege to the running account.
用户一旦通过以下方式启动可执行文件
As soon as the user launched the executable by
右键单击,以管理员身份运行
right-click, Run as administrator
问题消失了.
这篇关于WPF System.OutOfMemoryException System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!