Пользователь пытается строить отчёт за год (408 тысяч строк в источнике данных, каждая строка источника является строкой отчёта). Получает ошибку.
Можно ли оптимизировать, ускорить этот процесс и выполнить построение?
Код: Выделить всё
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Windows.Media.FormattedText.InitFormattedText(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode, Double pixelsPerDip)
at System.Windows.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode)
at Stimulsoft.Report.Wpf.StiTextHelper.GetFormattedText(StiTextInfo textInfo)
at Stimulsoft.Report.Wpf.StiTextHelper.MeasureText(StiTextInfo textInfo)
at Stimulsoft.Report.Painters.StiTableCellTextWpfPainter.Measure(Double width, StiComponent comp)
at Stimulsoft.Report.Painters.StiWpfPainter.MeasureComponent(Double width, StiComponent comp)
at Stimulsoft.Report.Components.StiWpfTextRender.MeasureString(Double width, StiText textBox)
at Stimulsoft.Report.Components.StiText.GetActualFont(String text, Single minFontSize)
at Stimulsoft.Report.Engine.StiPostProcessProviderV2.PostProcessPage(StiPage page, Boolean isFirstPage, Boolean isLastPage, Boolean clearPage)
at Stimulsoft.Report.Engine.StiPostProcessProviderV2.PostProcessPages(StiPagesCollection pages)
at Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)
at Core.WPF.Reporting.BaseReportViewModel.CreateReport(Object param) in D:\Prj\Sanatorium.git\sources\Core\Core.WPF.Controls\Reporting\BaseReportViewModel.cs:line 84
at Core.WPF.Reporting.BaseReportViewModel.CmdCreateReportAction(Object param) in D:\Prj\Sanatorium.git\sources\Core\Core.WPF.Controls\Reporting\BaseReportViewModel.cs:line 64
at Core.Client.DelegateCommand`1.Execute(T parameter) in D:\Prj\Sanatorium.git\sources\Core.Client\DelegateCommand.cs:line 243
at Core.Client.DelegateCommand`1.System.Windows.Input.ICommand.Execute(Object parameter) in D:\Prj\Sanatorium.git\sources\Core.Client\DelegateCommand.cs:line 337
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Код: Выделить всё
System.OutOfMemoryException: Выдано исключение типа "System.OutOfMemoryException".
в System.Windows.Media.FormattedText.DrawAndCalculateMetrics(DrawingContext dc, Point drawingOffset, Boolean getBlackBoxMetrics)
в System.Windows.Media.FormattedText.get_Metrics()
в Stimulsoft.Report.Wpf.StiTextHelper.MeasureText(StiTextInfo textInfo)
в Stimulsoft.Report.Painters.StiTableCellTextWpfPainter.Measure(Double width, StiComponent comp)
в Stimulsoft.Report.Painters.StiWpfPainter.MeasureComponent(Double width, StiComponent comp)
в Stimulsoft.Report.Components.StiWpfTextRender.MeasureString(Double width, StiText textBox)
в Stimulsoft.Report.Components.StiText.GetActualFont(String text, Single minFontSize)
в Stimulsoft.Report.Engine.StiPostProcessProviderV2.PostProcessPage(StiPage page, Boolean isFirstPage, Boolean isLastPage, Boolean clearPage)
в Stimulsoft.Report.Engine.StiPostProcessProviderV2.PostProcessPages(StiPagesCollection pages)
в Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
в Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
в Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
в Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
в Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)
в Core.WPF.Reporting.BaseReportViewModel.CreateReport(Object param) в D:\Prj\Sanatorium.git\sources\Core\Core.WPF.Controls\Reporting\BaseReportViewModel.cs:строка 84
в Core.WPF.Reporting.BaseReportViewModel.CmdCreateReportAction(Object param) в D:\Prj\Sanatorium.git\sources\Core\Core.WPF.Controls\Reporting\BaseReportViewModel.cs:строка 64
в Core.Client.DelegateCommand`1.Execute(T parameter) в D:\Prj\Sanatorium.git\sources\Core.Client\DelegateCommand.cs:строка 243
в Core.Client.DelegateCommand`1.System.Windows.Input.ICommand.Execute(Object parameter) в D:\Prj\Sanatorium.git\sources\Core.Client\DelegateCommand.cs:строка 337
в MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
в System.Windows.Controls.Primitives.ButtonBase.OnClick()
в System.Windows.Controls.Button.OnClick()
в System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
в System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
в System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
в System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
в System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
в System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
в System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
в System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
в System.Windows.Input.InputManager.ProcessStagingArea()
в System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
в System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
в System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
в System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
в System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
в MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
в MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)