Tuesday, July 7, 2020

Crystal Reports for VS 2010 and .Net 4 framework : "Load Report Failed" error

Problem:
If you have recently upgraded your project and started using Crystal Reports for VS 2010 and .Net 4 framework in your project, you might seen this error randomly or continuously after generating some reports. 

Cause:
Unlike previous versions of Crystal Reports, Crystal Report Engine is not releasing memory after closing reports. 

Solution:
After getting tired of this error, I started diagnosing this issue. I monitored the memory usage and found that memory usage is getting increased even after closing down the reports. So I added some code to restore memory after closing. Here is the addition to my code that solved my problem:


            rpt.Close()
            rpt.Dispose()
            rpt = Nothing
            GC.Collect()


Hope it will solve your problem. Enjoy Coding!

No comments:

Post a Comment

Popular Posts