Crystal Reports Max active instances

421 Views Asked by At

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 problem.

1

There are 1 best solutions below

1
Mike Cole On

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.