WPF System.OutOfMemoryException System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree

597 views Asked by At

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.

The stack trace reports:

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)

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.

Any suggestion?

Thanks!

1

There are 1 answers

0
Starnuto di topo On

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

the problem disappeared.