Skip to Content

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

Out Of Memory & Invalid Pointer exceptions on CSV export

Iu2019m having problems when exporting more than 1 million rows of data to a CSV format. Iu2019m running the export from C# code (see sample code below). Depending on the template that I use, I get either a System.OutOfMemoryException or a System.Runtime.InteropServices.COMException (Invalid pointer) error. See the full error text below.

This worked fine with Crystal XI but now breaks with Crystal 2008.

Is this a known problem and are there any workarounds?

Sample Code:

ReportDocument rptDoc = new ReportDocument();

rptDoc.Load("C:\somereport.rpt");

ExportOptions opts = new ExportOptions();

opts.ExportDestinationType = ExportDestinationType.DiskFile;

DiskFileDestinationOptions destOpts = ExportOptions.CreateDiskFileDestinationOptions();

destOpts.DiskFileName = "C:\outputfile.csv";

opts.ExportDestinationOptions = destOpts;

opts.ExportFormatType = ExportFormatType.CharacterSeparatedValues;

rptDoc.Export(opts);

Configuration:

Crystal Reports 2008 (Full Version)

C#

.NET 3.5

VS 2008

Exceptions:

System.Runtime.InteropServices.COMException occurred

Message="Invalid pointer\r"

Source="Analysis Server"

ErrorCode=-2147467259

StackTrace:

at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)

System.OutOfMemoryException occurred

Message="Exception of type 'System.OutOfMemoryException' was thrown."

Source="CrystalDecisions.ReportAppServer.Controllers"

StackTrace:

at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)

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