【发布时间】:2014-10-21 04:43:42
【问题描述】:
我已经处理这个问题很久了。有时它会抛出无效操作异常,有时会内存不足。随机用户,可以运行几天,一天内崩溃多次。
我从一位用户那里得到了调用堆栈,但不明白是什么原因造成的。这是一个具有丰富 UI 的 WPF 应用程序。许多视图,列表。使用 PRISM 和区域。
它还使用后台线程侦听 TCP、刷新数据并在 UI 线程上发送 PRISM 通知以进行更新。这个堆栈是否提供了我可能需要检查的任何线索?它不是源于我的代码..
在 MS.Utility.ArrayItemList
1[[System.Windows.Freezable+FreezableContextPair, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]..ctor(Int32) at MS.Utility.FrugalObjectList1[[System.Windows.Freezable+FreezableContextPair, WindowsBase,版本=4.0.0.0,文化=中性, PublicKeyToken=31bf3856ad364e35]].set_Capacity(Int32) 在 MS.Utility.FrugalObjectList`1[[System.Windows.Freezable+FreezableContextPair, WindowsBase,版本=4.0.0.0,文化=中性, PublicKeyToken=31bf3856ad364e35]].Insert(Int32, FreezableContextPair) 在 System.Windows.Freezable.AddContextToList(System.Windows.DependencyObject, System.Windows.DependencyProperty)在 System.Windows.Freezable.AddContextInformation(System.Windows.DependencyObject, System.Windows.DependencyProperty)在 System.Windows.Freezable.AddInheritanceContext(System.Windows.DependencyObject, System.Windows.DependencyProperty)在 System.Windows.DependencyObject.ProvideSelfAsInheritanceContext(System.Windows.DependencyObject, System.Windows.DependencyProperty)在 System.Windows.Freezable.OnFreezablePropertyChanged(System.Windows.DependencyObject, System.Windows.DependencyObject、System.Windows.DependencyProperty)
在 System.Windows.Media.RenderData.PropagateChangedHandler(System.EventHandler, 布尔值)在 System.Windows.UIElement.RenderClose(System.Windows.Media.IDrawingContent) 在 System.Windows.Media.VisualDrawingContext.CloseCore(System.Windows.Media.RenderData) 在 System.Windows.Media.RenderDataDrawingContext.DisposeCore() 在 System.Windows.Media.DrawingContext.System.IDisposable.Dispose() 在 System.Windows.Media.RenderDataDrawingContext.Close() 在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.Controls.DataGridCellsPanel.ArrangeChild(System.Windows.UIElement, Int32,排列状态)在 System.Windows.Controls.DataGridCellsPanel.ArrangeOverride(System.Windows.Size) 在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 MS.Internal.Helper.ArrangeElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)在 System.Windows.Controls.ItemsPresenter.ArrangeOverride(System.Windows.Size) 在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.Controls.Control.ArrangeOverride(System.Windows.Size)
在 System.Windows.Controls.Primitives.DataGridCellsPresenter.ArrangeOverride(System.Windows.Size) 在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size)
在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.Controls.Border.ArrangeOverride(System.Windows.Size)
在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.Controls.Control.ArrangeOverride(System.Windows.Size)
在 System.Windows.Controls.DataGridRow.ArrangeOverride(System.Windows.Size) 在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.Controls.VirtualizingStackPanel.ArrangeOtherItemsInExtendedViewport(布尔值, System.Windows.UIElement、System.Windows.Size、双精度、Int32、 System.Windows.Rect ByRef,System.Windows.Size ByRef, System.Windows.Point ByRef, Int32 ByRef) 在 System.Windows.Controls.VirtualizingStackPanel.ArrangeOverride(System.Windows.Size) 在 System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
在 System.Windows.UIElement.Arrange(System.Windows.Rect) 在 System.Windows.ContextLayoutManager.UpdateLayout() 在 System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object) 在 System.Windows.Media.MediaContext+InvokeOnRenderCallback.DoWork()
在 System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
在 System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object) 在 System.Windows.Media.MediaContext.RenderMessageHandler(System.Object) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate、System.Object、Int32、System.Delegate)在 System.Windows.Threading.DispatcherOperation.InvokeImpl() 在 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) 在 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback,System.Object,布尔值)在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback,System.Object,布尔值)在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback,System.Object)在 System.Windows.Threading.DispatcherOperation.Invoke() 在 System.Windows.Threading.Dispatcher.ProcessQueue() 在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr,Int32,IntPtr, MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate、System.Object、Int32、System.Delegate)在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)在 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 在 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) 在 System.Windows.Threading.Dispatcher.Run() 在 System.Windows.Application.RunDispatcher(System.Object) 在 System.Windows.Application.RunInternal(System.Windows.Window) 在 System.Windows.Application.Run(System.Windows.Window) 在 ArturExpress.Main.App.Main()
【问题讨论】:
-
我建议使用一些分析器来查看实际发生的情况。从这个描述真的很难猜到......
-
堆栈跟踪的实际异常是什么?它是 OutOfMemoryException 还是其他什么?另外,有没有内部异常?
-
不幸的是我无法追踪它。它是不可复制的,随机发生在用户机器上(可以好几天)。此堆栈跟踪来自事件日志。这是 OutOfMemoryException。
标签: c# wpf multithreading out-of-memory prism