WPF程序诡异错误,提示:无法在正在进行内容生成时调用StartAt
一个POS程序,在大多数情况下都正常,只是偶尔出现这个错误,但是一旦出现,就只能重装操作系统才能解决
错误堆栈如下:
鍦?System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.StartAt(GeneratorPosition position, GeneratorDirection direction, Boolean allowStartAtRealizedItem)
鍦?System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
鍦?Microsoft.Windows.Controls.Primitives.DataGridRowsPresenter.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
鍦?System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
鍦?System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
鍦?System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
鍦?System.Windows.Controls.Grid.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Border.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Control.MeasureOverride(Size constraint)
鍦?Microsoft.Windows.Controls.DataGrid.MeasureOverride(Size availableSize)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
鍦?System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
鍦?System.Windows.Controls.Grid.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
鍦?System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Border.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Control.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
鍦?System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
鍦?System.Windows.Controls.Grid.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Border.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
鍦?System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
鍦?System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Controls.Border.MeasureOverride(Size constraint)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?System.Windows.Window.MeasureOverrideHelper(Size constraint)
鍦?System.Windows.Window.MeasureOverride(Size availableSize)
鍦?System.Windows.FrameworkElement.MeasureCore(Size availableSize)
鍦?System.Windows.UIElement.Measure(Size availableSize)
鍦?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)
猜测是UI元素的生成和某控件发生冲突导致, 界面有定时器来刷新界面时间,用了观察者设计模式,求大神