Skip to Content
Former Member
Feb 10, 2011 at 05:41 AM

Using Crystal Reports 2008 causes System.AccessViolationException


The SAP OEM team has been engaged to help solve this problem as it is a high priority issue.

We are attempting to use Crystal Report 2008 with a 32-bit .NET (3.5) C# application in VS2008. When running the initial report in the Crystal Viewer there are no exceptions. However, when I try to use the viewer in any way like paging, using the group tree, exporting, or even zooming (basically anything that causes the page_load to run again), then I get the following exception:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.get_ProductLocaleID()

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.get_ProductLocaleID()

at CrystalDecisions.ReportSource.CachedObjectReportSource.GetReport(RequestContext context, Boolean bAddToCacheWhenCreated)

at CrystalDecisions.ReportSource.CachedObjectReportSource.InternalGetReport(RequestContext context, Boolean bAddToCacheWhenCreated)

at CrystalDecisions.Web.CrystalReportSource.get_ReportDocument()

at EyeQ.AppointmentResultsReport.Page_Load(Object sender, EventArgs e) in f:\VHT\Code\Workspaces\Crystal2008Testing\WebProjects\TestApp\Report.aspx.cs:line 173

The line of code that it is referring to is attempting to access a TextObject in the report that is in the page_load

TextObject to = ((CrystalDecisions.CrystalReports.Engine.TextObject)Report.ReportDocument.ReportDefinition.ReportObjects["Text72"]);

If i remove any access to TextObject's in the report then I get the same exception when I attempt to set report parameters

Report.ReportDocument.SetParameterValue("StartDate", StartDate);

Or when I connect the report to the database...and so on and so forth. Basically, any other time the page_load runs and the report document is accessed for any reason, the same exception is thrown.

The Page Load does:

- localizing (getting text objects from the report)

- connects report tables

- sets report name (name of the report file)

- sets parameter values

A very simple report with no other manipulation work fine but the page_load MUST do these things.

This issue is seen on the development environment and on the test servers. Note that it seems that this issue has been seen by others before in varying degrees and has been reported on this forum. Any ideas as to why this is occurring and how to approach a solution would be great.