Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Intermittent Error Running Report

I have an intermittent issue with the WPF report Viewer.  I run a report and get the window open with the busy circle as per normal but then there is a  Invalid report file path error appearin, then a blank report is shown in the viewer.   If I run the report again everything is fine.   Can anyone help to explain why this is happening

The error being reported is.

Error Exception: SEHException

Error Message: External component has thrown an exception.

Error Stack Trace:

   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.RemoveAfterFormatPageEventCallBack(ISCRAfterFormatPageEventCallBack formatPageEventCallBack)  

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.RemoveAfterFormatPageEventCallBack(ISCRAfterFormatPageEventCallBack eventCallback)   

at CrystalDecisions.CrystalReports.Engine.ReportDocument.ClearCache(Boolean clearDocument)   

at CrystalDecisions.CrystalReports.Engine.ReportDocument.InternalClose(Boolean bSetupForNextReport)   

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Close()

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)  

at CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport()

at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_Database()

at ....ReportViewer.CleanUpObjectsForMemoryLeak() in ...ReportViewer.xaml.cs:line 307     at ....ReportViewer.Window_Unloaded(Object sender, RoutedEventArgs e) in..\ReportViewer.xaml.cs:line 297  

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.RaiseEvent(RoutedEventArgs e)   

at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)   

at System.Windows.BroadcastEventHelper.BroadcastUnloadedEvent(Object root)   

at MS.Internal.LoadedOrUnloadedOperation.DoWork()  

at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()

at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()

at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)  

at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)  

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)   

at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)  

FYI the CleanUpObjectsForMemoryLeak code is listed below and all references - which should only be on window close or disposal of window

        private void CleanUpObjectsForMemoryLeak()

        {

            if (this.vwCrystalReportViewer != null)

            {

                var objRptDocViewer = (ReportDocument)this.vwCrystalReportViewer.ViewerCore.ReportSource;

                if (objRptDocViewer != null)

                {

                    foreach (CrystalDecisions.CrystalReports.Engine.Table table in objRptDocViewer.Database.Tables)

                    {

                        table.Dispose();

                    }// Line 297

                    objRptDocViewer.Database.Dispose();

                    objRptDocViewer.Close();

                    objRptDocViewer.Dispose();

                    objRptDoc.Close();

                    objRptDoc.Dispose();

                    objRptDoc = null;

                }

                this.ParameterValues = null;

                this.PassedReport = null; //Line 307

                if (this.vwCrystalReportViewer.ViewerCore.ParameterFieldInfo != null)

                    this.vwCrystalReportViewer.ViewerCore.ParameterFieldInfo.Clear();

                if (this.vwCrystalReportViewer.ViewerCore != null)

                {

                    this.vwCrystalReportViewer.ViewerCore.Content = null;

                    this.vwCrystalReportViewer.ViewerCore.Dispose();

                }

                if (this.vwCrystalReportViewer.Owner != null)

                {

                    this.vwCrystalReportViewer.Owner = null;

                }

                this.vwCrystalReportViewer = null;

                GC.Collect();

            }

        }

private void Window_Unloaded(object sender, RoutedEventArgs e)

        {

            CleanUpObjectsForMemoryLeak();

        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)

        {

           e.Cancel = true;

            CleanUpObjectsForMemoryLeak();

            this.Visibility = System.Windows.Visibility.Collapsed;

        }

~ReportViewer()

        {

            try

            {

                CleanUpObjectsForMemoryLeak();

            }

            finally { }

        }

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question