Exception в Report.show()
У меня есть грид. При смене выделенной строки по ней строится отчет и отображается в PreviewControl. Если часто менять менять выделенную строку грида (то есть при частых вызовах report.Show() для одного и того же отчета, но с разными данными) происходит такой эксепшен:
The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at FastReport.Base.ExtractDefaultMacros(String text)
at FastReport.ReportPage.ExtractMacros()
at 8iYEy3986EjYAGn2qmy.WsaUlW9H4w27L5DnpGf.317e4dMPx(Base )
at 8iYEy3986EjYAGn2qmy.WsaUlW9H4w27L5DnpGf.CTXmI8Nr1(Int32 )
at FastReport.Preview.PreparedPages.GetPage(Int32 index)
at 1FIsHh9U8YdfQksVmN9.AvNbFU90oQt0qbmYRro.317e4dMPx(Int32 )
at FastReport.Preview.PreparedPages.ysHcHQyZU(Int32 )
at EYKDyLo4SM87NEmD4OL.IEEIodoXevboP0qT6RN.ysHcHQyZU(Graphics )
at EYKDyLo4SM87NEmD4OL.IEEIodoXevboP0qT6RN.OnPaint(PaintEventArgs )
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.DoEvents()
at usVCNiL5aoGEFk1QEy1.SOLIs3LpH28MMFhBH3g.moxxpB6om(String )
at FastReport.ReportSettings.Dnc4sCimh(Report )
at FastReport.Engine.ReportEngine.QZRHOKlkp(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.QBDropcyo(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at FastReport.Report.Show(Boolean modal, Form owner)
at FastReport.Report.Show()
если быстро меняются не только данные, но и сам отчет, то может произойти такой exception:
Object reference not set to an instance of an object.
at FastReport.ReportSettings.Dnc4sCimh(Report )
at FastReport.Engine.ReportEngine.QZRHOKlkp(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.QBDropcyo(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at FastReport.Report.Show(Boolean modal, Form owner)
at FastReport.Report.Show()
похоже какие-то потоковые ошибки, нужно lock{} поставить.
Дополнительная информация:
Код выполняющийся при смене строки грида:
uc_Report.Load(fileFullName);
uc_Report.RegisterData(new List<object> { entity }, "{0}_DataSource".FormatWith(entity.GetType().Name));
uc_Report.Show();
The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at FastReport.Base.ExtractDefaultMacros(String text)
at FastReport.ReportPage.ExtractMacros()
at 8iYEy3986EjYAGn2qmy.WsaUlW9H4w27L5DnpGf.317e4dMPx(Base )
at 8iYEy3986EjYAGn2qmy.WsaUlW9H4w27L5DnpGf.CTXmI8Nr1(Int32 )
at FastReport.Preview.PreparedPages.GetPage(Int32 index)
at 1FIsHh9U8YdfQksVmN9.AvNbFU90oQt0qbmYRro.317e4dMPx(Int32 )
at FastReport.Preview.PreparedPages.ysHcHQyZU(Int32 )
at EYKDyLo4SM87NEmD4OL.IEEIodoXevboP0qT6RN.ysHcHQyZU(Graphics )
at EYKDyLo4SM87NEmD4OL.IEEIodoXevboP0qT6RN.OnPaint(PaintEventArgs )
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.DoEvents()
at usVCNiL5aoGEFk1QEy1.SOLIs3LpH28MMFhBH3g.moxxpB6om(String )
at FastReport.ReportSettings.Dnc4sCimh(Report )
at FastReport.Engine.ReportEngine.QZRHOKlkp(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.QBDropcyo(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at FastReport.Report.Show(Boolean modal, Form owner)
at FastReport.Report.Show()
если быстро меняются не только данные, но и сам отчет, то может произойти такой exception:
Object reference not set to an instance of an object.
at FastReport.ReportSettings.Dnc4sCimh(Report )
at FastReport.Engine.ReportEngine.QZRHOKlkp(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.QBDropcyo(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at FastReport.Report.Show(Boolean modal, Form owner)
at FastReport.Report.Show()
похоже какие-то потоковые ошибки, нужно lock{} поставить.
Дополнительная информация:
Код выполняющийся при смене строки грида:
uc_Report.Load(fileFullName);
uc_Report.RegisterData(new List<object> { entity }, "{0}_DataSource".FormatWith(entity.GetType().Name));
uc_Report.Show();
Комментарии
if (report1.IsRunning)
return;
...
Если это не поможет, пришлите, пожалуйста, пример, демонстрирующий ошибку, на tz@fast-report.com.