When dealing with CrystalReports from the codebehind, Garbage Collection needs to be handled as there is a known issue where after opening the document 25-30, the application will error out and will through an exception stating that the report path is invalid.
This issue is infuriating when out of the blue things stop working minutes before a product demo to a customer (murphies law I swear!)
Fortunately I have cool customers. I found the solution midway through the comments in the following post.
The following is the sample C# code that worked in my document. Note that I am using dll Version 11.5.3700.0
private static ReportDocument reportDocument = new ReportDocument();
// Code that handles reportDocument
protected void Page_Unload(object sender, EventArgs e)
{
reportDocument.Close();
reportDocument.Dispose();
GC.Collect();
}
No comments:
Post a Comment