I have a windows 2012 64bit service application (built in c# VS2010, CR engine version v2.0.0.50727) that in addition to some other tasks parses text out of unstructured files, creates a Crystal Report and then automatically saves the report as PDF to disk. This process works well for about 12 hours then suddenly starts generating an error upon the call to CReport.Export(). The error is "Object Reference not set to the instance of an object.". If I switch the service account to a different user then it starts working again for about 12 hours (presumably some number of exports) and then it starts generating the error. Stopping and starting the service has no effect, the user simply can no longer call the export method. I have replicated this with the GUI calling the same bit of code. It seems that the user reaches a maximum number of report exports and then cannot export anymore reports. Below is the code (retyped for brevity) that generates the report Any help would be much appreciated!
object report = new Reports.ExportContent(); ReportDocument crReportDocument = (Reports.ExportContent)report; crReportDocument.SetDataSource((DataTable)contentReport.Content); Stream crIn = crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat); //This call starts failing after some number of exports for the user FileStream crOut = new FileStream(outputinfo) //create a buffer //write to the buffer and then to file while there is some data //close filestream //some error catching //finally crReportDocument.Close(); crReportDocument.Dispose(); GC.Collect