cancel
Showing results for 
Search instead for 
Did you mean: 

Crystalreportviewer export not working hangs application

Former Member
0 Kudos

We are using Crystal Report 13 with VisualStudio 2010 (Dot Net FW 4.0) in our desktop application.

When we are trying to export report using CrystalReportViewer's ExportReport button, application just get hangs on Windows Server 2008 and Windows 7 machines.

Same thing is working fine on Windows XP and Windows 2003 server.

But when we are doing exporting through code we are successfully able to do it.

Just for information we are deploying application with CRforVS_redist_install_64bit_13_0(for 64 bit machine) and CRforVS_mergemodules_13_0 (for 32 bit machine)

Please let us know whether we are missing anything while deploying our application.

Thanks & Regards,

Prashant Kedari

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

we are deploying application with CRforVS_redist_install_64bit_13_0(for 64 bit machine) and CRforVS_mergemodules_13_0 (for 32 bit machine)

- so is this a 32 bit or a 64 bit app? The runtime is not dependent on the "bitness" of the OS. It is dependent on the "bitness" of the app. E.g.; a 32 bit app only requires a 32 bit runtime - 32 bit OS or 64 bit OS...

- What format are you exporting to? Have you tryed other export formats?

But when we are doing exporting through code we are successfully able to do it.

- I assume from the above that the export is not working if you use the viewer export button? On click of the export button, you should be presented with a dialog for export format type and location. I assume you are able to see this dialog and you are able to select the export file type and the "hang" occurs after you click the <OK> button?

- Are you able to print to a printer?

- Using [Processd Monitor|http://technet.microsoft.com/en-ca/sysinternals/bb896645.aspx] may give you clues as to what is happening on the export event

- Ludek

Former Member
0 Kudos

Thank you for your reply. Below I have given the more information about your queries.

So is this a 32 bit or a 64 bit app?

- When we are building our application itu2019s build with option u201CAny CPUu201D in VS2010 so it will support both operation system 32 and 64 bit.

I assume from the above that the export is not working if you use the viewer export button? On click of the export button, you should be presented with a dialog for export format type and location.

- Yes, you are right. Export is not working if we use the viewer export button, and we are not able to see the dialog for export format type at all. When we just click on the button report viewer itu2019s showing processing icon and just hangs up at that point on Windows Server 2008 and Windows 7 machines. Same thing is working fine on Windows XP and Windows 2003 server.

What format are you exporting to? Have you tried other export formats?

- When we are doing exporting through code we are successfully able to do it by selecting any format.

Are you able to print to a printer?

- Yes we are able to print to a printer.

I have gone through the Processd Monitor utility with my application, but not able to get any clue related to exporting failure.

Thanks & Regards,

Prashant Kedari

former_member183750
Active Contributor
0 Kudos

Do not build as "Any CPU". Select either 32 or 64 bit, then use the appropriate runtime.

- Ludek

Former Member
0 Kudos

Once again thank you for your reply.

As you mentioned, we tried by building our application with option "x86" and "x64" respectively for 32 and 64 bit operating system, but not get success. Application is still getting hang.

We are using separate thread in our application for showing report in CrystalReportViewer, as we have huge database and if we keep both in single thread it will freeze our main form of application.

One observation is that when we are trying to close our hang application, one entry is getting added in windows application log.

Level - Source - Event ID - Task Category

Error - Application Hang - 1002 - (101)

In details section of this log it's mentioning about Cross-Thread Deadlock.

Thanks & Regards,

Prashant Kedari

Edited by: pskedari on Apr 12, 2011 8:37 AM

Edited by: pskedari on Apr 12, 2011 8:39 AM

former_member200290
Contributor
0 Kudos

Hi Prashant,

Just curious, when you create the ReportDocument object, do you keep it isolated to a single thread, or are you using it across multiple threads?

If you are using it amongst multiple threads than this is the problem. The ReportDocument can be run in a multi-threaded application, however only the thread it is in can safely call it.

Now one of the reasons as a developer you may want to call it across threads is you want to view in one thread and export in another. This will not work. You will need two different ReportDocuments objects to accomplish this. If you are concerned about the two ReportDocuments both hitting the database, then I would suggest reporting off of a ado .NET dataset and sharing the dataset.

Kind Regards,

Trevor

Former Member
0 Kudos

Thank you for your reply Trevor.

We are creating the ReportDocument object in our child thread, and we are keeping it isolated to single thread only,

My application is working on XP and 2003 server machine but failing on windows 7 and 2008 server machine.

Thanks & Regards,

Prashant Kedari

former_member200290
Contributor
0 Kudos

Hi,

Thank you for the information, I would like to test this, but it does take some time. Some more information that could help me out would be to know is if you are putting the viewer control on a child form which is created in the thread or is the viewer on a main form running from the main parent thread?

Thanks,

Trevor

UPDATE: I forgot to mention do you have DEP turned off or at least on for essential windows services only?

Edited by: Trevor Dubinsky on Apr 13, 2011 9:15 AM

Former Member
0 Kudos

Hi Trevor,

Thank you for your reply.

We are putting the viewer control on a child form which is created in the child thread.

Regarding DEP, we have settings like "Turn on DEP for essential Windows programs and services only" on Windows 7 machine.

Thanks & Regards,

Prashant Kedari

former_member200290
Contributor
0 Kudos

Hello Prashant,

I believe I have figured this one out. You need to set the apartment state property of your thread. For example here is my code that got this to work:

Thread oThread = new Thread(new ThreadStart(ShowForm));

oThread.SetApartmentState(ApartmentState.STA);

oThread.Start();

I hope this gets you going! Let me know!

Trevor

Former Member
0 Kudos

Hi Trevor,

Yes, after doing mentioned change , now we are able to do export report through CrystalReportViewer on Windows 7 and Windows Server 2008 machine.

This solution resolves our problem.

Thank you Trevor, Thank you very much.

Regards,

Prashant Kedari

Answers (0)