cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalReportViewer freezes

Former Member
0 Kudos

(This is a copy of my original post in )

Hello, this is my first post in these forums, I hope someone here will know the answer to my question, I tried searching for this everywhere but I didn't really find anything.

I'm using Visual Studio 2005 and Crystal Reports that come with it. I've designed a report that gets filled from a DataSet object (no connections to database or anything, just a plain simple DataSet.) The report contains two subreports, both of them are also filled with DataSets.

Everything works fine on my computer and a couple of other testing PCs but when the application is deployed at the customer, it sometimes doesn't work - when the form containing CrystalReportViewer opens, the application freezes. The cursor is changed to hourglass, the report area shows big white blank page and the application is not responding anymore.

I thought that the problem may be with printers, the printer setting were set to my default printer so I changed them to "No Printer" (in Page Setup...) for all three reports (and I also re-imported the subreports after that). Nothing changed.

Also this problem doesn't happen all the time, for example it may not happen in the morning but then in the afternoon it doesn't work anymore.

Any ideas what could be wrong?

Michal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Have you tried the closing and disposing of reports object in code.

Regards,

Amit

Answers (2)

Answers (2)

former_member183750
Active Contributor
0 Kudos

All of the question in the previous two posts need to be answered. Also; What version of CR are you using?

Ludek

Former Member
0 Kudos

Oh yes I forgot, I'm using the default version of CrystalReports that came with Visual Studio 2005. I don't know how to find exatly the version of Crystal Reports but the versions of my CrystalDecisions.* assemblies range from 10.2.3600.0 to 10.5.3700.0.

Former Member
0 Kudos

can I have an idea how you did your deployment?also, Is it a web or win app?

Former Member
0 Kudos

Hello, thank you for your responses!

It's a windows forms application, I have a form that contains a single control, the CrystalReportViewer. The function which opens the report first fills a dataset with data, then creates the report and sets its datasource like this:

Dim report As New VertragsuebersichtReport

report.SetDataSource(mainData)

DirectCast(report.ReportDefinition.ReportObjects("Header"), _

CrystalDecisions.CrystalReports.Engine.SubreportObject).OpenSubreport("HeaderReport.rpt").SetDataSource(headerData)

DirectCast(report.ReportDefinition.ReportObjects("Filter"), _

CrystalDecisions.CrystalReports.Engine.SubreportObject).OpenSubreport("FilterReport.rpt").SetDataSource(filterData)

DirectCast(report.Section2.ReportObjects("Text7"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = year

DirectCast(report.Section2.ReportObjects("Text8"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = year + 1

Dim f As New frmReportViewer

f.CrystalReportViewerControl.ReportSource = report

f.Show()

To Amit Singh: I'm not sure what you mean, my application freezes when I try to create and show the report so it never gets to the point where I could possibly close it and dispose it.

Former Member
0 Kudos

Hi Michal,

About the close and dispose method-

When you creates the object of Reportdocument then it will take space in memory depending upon how you are creating them i.e. for every event or once .

As objects created in process with out using the disposing, it would capture whole memory - result - new objects might not be getting created.

Hence it might be a reason of freezing of reports.

As mentioned in the first note that reports are running fine for near about 15 minutes, I suggest you to use this code and also the garbage collection.

Hope this helps

Amit

former_member183750
Active Contributor
0 Kudos

To add to Amit's note. It may not be a bad idea to check if a report object exists before instantiating it. If it does, do .close and .dispose. Or you can do it on form unload, or after

f.CrystalReportViewerControl.ReportSource = report

f.Show()

Also, download the latest SP for CR 10.2 from here:

https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe

Ludek

Former Member
0 Kudos

To clarify, the report loading doesn't work right from the start of the application. I.e. the client starts the application and the first report he tries to open freezes the application. So this is not a close / dispose issue or issue with multiple instances of a report. (Although I believe that having multiple instances of the same report shouldn't be a problem?)

Former Member
0 Kudos

I didn't mention this, the Crystal Reports runtime libraries that we installed at our customer and also on our test machines already contain SP1.

Edited by: Michal Burger on Sep 18, 2008 9:28 PM (typo)

Former Member
0 Kudos

Hi,

As mentioned in first note

 it sometimes doesn't work 

if this is the case then apply the suggested methods by me and Ludek.

Although its a good practice to use these codes in the application

Amit

former_member183750
Active Contributor
0 Kudos

OK. Sorry Michael, but I think we finally have all the info we need.

Oh, one more thing. What's the OS for the boxes that don't work? (If it's Vista, could it be that DEP is getting in the way?)

I'd like to run two utilities to see what's up.

1) Download modules from here;

https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip

This utility will help us compare dlls - just to make sure...

here is how to run it:

1) unzip the above file

2) run your app on your development system, process a report. leave the app running

3) Start modules

4) Go to the File menu and select New List -> memory modules

5) save the file as dev.mdl

6) Copy modules to one of the computers that does not work

7) Start the app - let it hang and while it is not responding start modules

😎 Go to the File menu and select New List -> memory modules

9) save the file as client.mdl

10) You can now compare the results. Open both mdls in modules.

11) Expand the "By Process" node, find your app exe and click on it. This will populate the right pane with the dlls loaded. Do this with both mdl files. To see more details, go to the Module menu and select Differences

The second utility I'd like to try is Process Monitor. this is a MS utility that can be downloaded from here:

http://www.microsoft.com/technet/sysinternals/Utilities/SysinternalsSuite.mspx

Run it on the problem computer only. Once you have the log, search for any messages like access denied, could not find file, etc., etc. (The quicker you stop procmon the easier it will be to read the log - it gets quite long fast...)

Ludek

Former Member
0 Kudos

Wow, looks great, thank you very much, I'll try these utilities tomorrow.

About OS, we were testing it on Vista and everything worked fine but anyway my development PC is XP and the customer's PC is also XP.

Former Member
0 Kudos

Oh by the way regarding the modules, I very much doubt they will be different between the customer's PC and our testing machines because we did the exact same installation on our testing machines as at the customer (no visual studio, just installed the crystal reports runtimes and our application) but I will try to compare the versions anyway.

former_member183750
Active Contributor
0 Kudos

Understood. It is a shot in the dark and I do appreciate you going along with the suggestion. We'll see tomorrow...

I'm outta here. Have a great evening,

Ludek

Former Member
0 Kudos

The problem didn't come back on friday nor today so I haven't been able to test it anymore. It's been bugging us for a week and now it's gone. There's one thing that has changed - the form which contained the CrystalReportViewer control had in its Load event the following code:

ReportView.RefreshReport()

(ReportView is the CrystalReportViewer control.) I don't know why it was there but I removed it probably on thursday and I think the problem didn't happen ever since then. I'll leave this thread open for a while and if we don't see the problem come back in a couple of days I guess I'll consider this question answered. Thanks for help from everyone who tried to answer this question .

0 Kudos

Hi Michael,

That would explain it. The delay/busy is likely a database timeout, OLE DB and ODBC default to 1 minute. Not sure what a dataset uses, or if there isn't one defined CR would simply continue to try to connect to the data which doesn't exist.

Thank you for psoting your find.

Don

Former Member
0 Kudos

I dont't think this is a database timeout because the report doesn't connect to any database. It uses an offline dataset as in:

Dim dt As New DataTable

dt.Columns.Add("column1")

dt.Rows.Add("value1")

dt.Rows.Add("value2")

Dim ds As New DataSet

ds.Tables.Add(dt)

report.SetDataSource(ds)

0 Kudos

Hi Michal,

The RefreshReport would cause a database connection to fire. This is likely the delay CR does if the data source cannot be found.

Thanks again

Former Member
0 Kudos

Hm, interesting. How do I know what connection is the report trying to open?

0 Kudos

Hi Michal,

Using native memory DB drivers like this one there is no way to see without a debug version of our engine and DB driver to see where and when we are connecting. To get one would require an escalation so R&D could enable logging for the required functions and because this is for info only they would not do it.

Thanks again

Don

Former Member
0 Kudos

I have the source codes of my application, obviously :-). Or is it impossible to tell what connections will the report try to open even if it's me who created it?