1712799 - On form close - WPF viewer not released from memory

SAP Knowledge Base Article - Public

1712799 - On form close - WPF viewer not released from memory

Symptom

  • Viewing many reports using the WPF viewer in an application results in high memory usage (about 8 MB per report view)

Environment

  • SAP Crystal Reports for Visual Studio 2010
  • Visual Studio 2010

Cause

  • The Crystal Report viewer is not being released from memory even though the window that contains it has been closed

Resolution

  • Issue has been tracked ADAPT01633561 and resolved in Service Pack 5

 

  • Workaround (suggested before above resolution:

Handle the closing of the window and just minimize the window rather than close it.  This means that every report is viewed in the same window rather than a new window each time.  This prevented the crash and handled the memory consumption quite well.  You can try this as a workaround while we investigate the issue.

     private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
             e.Cancel = true;
            _report.Close();
            _report.Dispose();
            this.Visibility = System.Windows.Visibility.Collapsed;
        }

Keywords

CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 2012 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio