I have this message in my inbox but never had time to give it a serious try:
> > Is it possible to preload assemblies before they are called? Each
> > time the first report in my app runs, it takes 10-15 secs while it
> > loads the appropriate assemblies, after that any report that is run
> > appears immediatly.
>
> Here you go...
>
> ' load up crystal when the app starts up.
> ' use a separate thread since its such a pig.
> TraceWriteLine("starting Crystal Reports Thread")
> myTimer = New FunctionTimer("load crystal")
> Dim t As New Thread(AddressOf LoadCrystal)
> t.Priority = ThreadPriority.BelowNormal
> t.Start()
> myTimer.EndTimer()
> TraceWriteLine("...thread started")
>
>
> ' here's the code to load up a dummy report.
> ' this seems to load up and keep everything in memory throughout the
> life of the app.
>
> Public Sub LoadCrystal()
> crReport = New ReportDocument
>
> Try
> ' Need to preload crystal engine so the reports will print
> quickly throughout the rest of the application.
> ' This report is not used, it is just loaded. Testing so
> far 12/23/04 has not shown any
> ' problems such as memory or print errors.
> crReport.Load(CrystalRepor
>
> Catch ex As Exception
> DisplayException(ex, "Error: Could find the startup
> Crystal Report named 'rptBlank.rpt'." & _
> vbCrLf & "If you are a new user, you may lack Server
> permissions to read this directory and file: " & CrystalReportFolder &
> "rptBlank.rpt" & _
> vbCrLf & "Or the report may have been deleted or
> corrupted. Please Call IT. [EJS0412311300]")
> End Try
> End Sub
>
Main Topics
Browse All Topics





by: CodeCruiserPosted on 2009-04-05 at 05:47:10ID: 24071300
This is down to the .NET implementation of Crystal Reports. I face the same problem in my applications. When the report is loaded first time, the CLR has to load dozens of DLLS related to Crystal Reports. Loading and initializing these DLLs takes time. But if you open the report again, these DLLs are already in memory so it loads straight away. When you close the app, the DLLs get unloaded and the behavior is repeated. It really is irritating. In one of my apps, the report is huge on more than 40 pages with links to dozens of pictures, logos etc and it takes many minutes to load each time rather than seconds.