Question

I have a WPF billing solution that is deployed using ClickOnce for more than 500 users, CrystaReports2010 were used for reporting, 85% of the users have WindowsXP installed on their machines :(

The Crystal Reports works just fine on the WindowsXP machines until the user exports a report with the built-in export button in the Crystal Reports Viewer, if he did this the export process complete successfully but he is not able to open any other report in the solution until he restarts the application.

Export Button

This is the error when trying to open a new report after the export:

The Error Message

I save the reports in my solution as content external resources outside the application .exe file, and I load them on demand, something like this:

var report = new ReportDocument();
report.Load(@"Reports\MyReport.rpt");

I made sure that after the user close a report to close and dispose of the report document object, so no memory leaks or exceeding the max number of open reports.

If I changed my implementation so that I save the reports inside my solution as embedded resources, the problem is solved, but this is not an option because the reports are relatively big in size (200KB-450KB), it will be a big DLL file that will be downloaded to the clients through ClickOnce whenever we release a new version that has any change to any report!. Another variation is to group each let's say four reports into one DLL, and still the same problem (1MB-2MB is still a big chunk). Knowing that we have a lot of reports and we get frequent change request for these reports according to changes in our client's policies. Please Help!

Was it helpful?

Solution 3

At last, I found the solution :) The problem was that when you export a Crystal Report with the default export button provided by the Crystal Reports viewer, the export button changes the current working directory of the application to the export location!!! (strange behavior!!) and that is why the following line wont work anymore:

report.Load(@"Reports\MyReport.rpt");

So I changed this line to the following:

report.Load(AppDomain.CurrentDomain.BaseDirectory + "\\" + @"Reports\MyReport.rpt");

And it worked just like magic :)

OTHER TIPS

To solve this problem you have to change the installed .net version on the client machine from client profile to the full .net version.

Are you closing and disposing your report documents once you're finished with them?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top