views:

47

answers:

1

I'm having trouble loading (several) multiple instances of crystal's ReportDocuments in memory. Using the following code:

        Dim sRPT As New ReportDocument
        sRPT.Load("PATH\TO\MY.RPT")

        Dim sRPTs As New List(Of ReportDocument)
        For i = 0 To 100
            Dim sClone As ReportDocument = sRPT.Clone
            sClone.Refresh()

            sRPTs.Add(sClone)

            Console.WriteLine("RPT Clonado " & i.ToString())
        Next

when I reach the 74th instance, the Refresh() call throws a "Report Load failed" exception. Furthermore, the same exception happens even directly calling the .Load(path) method, and affects all ReportDocumetns within the application, regardless the RPT file I'm loading/refreshing.

I'm currently using Crystal XI R2, but testing this code with the v12 assemblies (CR 2008) ended with the same problem.

Has anyone ever stumbled with something like this? The reason for all this instances is a report caching for multiple rpt files, per user, and will most likely stay as it is if there is a not-so-nasty workaround for this problema.

Thanks in advance,

Germán

A: 

I ran into this before, and AFAIK the only way around it is to make sure you close the reports when you are done with them.

Mike C.
Thanks for the quick post! We had to review all the code from the reporting modules some time back for a similar problem too. But this "report caching" aims to maintain open ready-to-use instances so we don't need to open this reports every time we need to use it (the RPTs we use take forever to load and probably we won't be allowed to change them) so closing *all* cached reports is not an option (we are partially cleaning the cache if there are unwanted - forever idle - report instances).Thanks again,Germán
Germán Enríquez