cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Can't close Reportdocument class

Former Member
0 Likes
1,597

Hi all,

Imagine this simple piece of code:

Dim RptDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument

RptDoc.Load("C:\Report1.rpt")

RptDoc.PrintToPrinter(1, False, 1, 0)

RptDoc.Close()

RptDoc.Dispose()

Report1.rpt is a simple report with a label and no DB connection (just for a try)

When tryng to process RptDoc.Close system hangs (i always stopped so i don't know how long it can take to close)

Same issue with Using / End Using

Using RptDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument

RptDoc.Load("C:\Report1.rpt")

RptDoc.PrintToPrinter(1, False, 1, 0)

End Using

I'm woking with VS2010 and CR 13

Normally miy reports have a DB connection to Oracle but wanted to see if the close also fails with a very simple report and it does !

Any ideas ?

View Entire Topic
Former Member
0 Likes

Thanks David for your answer.

I did enable logging and saw the files. While my app is still hanging ... here are ending contents of the log files.

As you can see from files last log time was 11:55 and now it's 12:07 and app is still waiting for instruction Reportdocument.Close to be completed...

The bkgrnd file :

|228f675c-2139-c554-4949-2b2cfe59fd66|2011 01 06 11:53:32:062|+0100|==| | |bkgrnd| 3756|2072|| |0|0|0|0|CRPE.CRPEBackgroundThread|localhost:3756:2072.21:1|-|-|CRPE.CRPEBackgroundThread|localhost:3756:2072.21:1||||||||||||0x818 11:53:32.046 13 1 PEClosePrintJobRequest Report1 {304AFC1B-A4A7-4897-AA43-1D181C131F50}.rpt closing print job 0 19 <==

|01e832e1-1965-7aa4-db28-47219801858b|2011 01 06 11:53:32:062|+0100|==| | |bkgrnd| 3756|2072|| ||||||||||||||||||||||0x818 11:53:32.062 0 threadProc 0 0 <==

|b90c2e0d-4165-7334-39a7-9b676320ff24|2011 01 06 11:53:32:062|+0100|==| | |bkgrnd| 3756|2072|| ||||||||||||||||||||||0x818 11:53:32.062 0 0 threadProc Worker thread stopping. 0 0 <==

The diagnostic file (where it seems CR has still 2 jobs to close):

|a2631294-0777-8464-f850-a07044febada|2011 01 06 11:53:32:062|+0100|==| | |Diagnostics| 3756|1564|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:755,Closing engine,Start Time,"11:53:32"

|425119da-6d03-41e4-2a87-55b32f8300e8|2011 01 06 11:53:32:062|+0100|==| | |Diagnostics| 3756|1564|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:797,Closing engine,Before close engine use count,"3"

|96941a67-cb58-40b4-aa25-5fabbd2f283b|2011 01 06 11:53:32:062|+0100|==| | |Diagnostics| 3756|1564|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:822,Closing engine,After close engine use count,"2"

|63f7eed4-9741-b804-59ee-9033988dc1a4|2011 01 06 11:53:32:062|+0100|==| | |Diagnostics| 3756|1564|| ||||||||||||||||||||||N/A:-1,Closing engine,Elapsed Time,"1"

|df2392a4-3ee2-8734-dbef-caa5bfc10ac0|2011 01 06 11:53:32:078|+0100|==| | |Diagnostics| 3756|3412|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:755,Closing engine,Start Time,"11:53:32"

|94dc8588-d50d-ebc4-0862-46232deac6d4|2011 01 06 11:55:12:093|+0100|==| | |Diagnostics| 3756|1564|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:755,Closing engine,Start Time,"11:55:12"

The functions file:

|318a5bcc-6ced-6ca4-fa98-72d9dda7a92e|2011 01 06 11:53:32:046|+0100|==| | |functions| 3756|1564|| ||||||||||||||||||||||0x61c 11:53:32.046 1 PEClosePrintJob Report1 {304AFC1B-A4A7-4897-AA43-1D181C131F50}.rpt 0 jobN:1 IN 19 <==

|84a8caac-939f-c854-e802-030217b73523|2011 01 06 11:53:32:062|+0100|==| | |functions| 3756|1564|| ||||||||||||||||||||||0x61c 11:53:32.046 15 1 PEClosePrintJob Report1 {304AFC1B-A4A7-4897-AA43-1D181C131F50}.rpt 0 OUT jobN:1 19 <==

|67a35a91-1227-2244-6a96-920efec0d512|2011 01 06 11:53:32:062|+0100|==| | |functions| 3756|1564|| ||||||||||||||||||||||0x61c 11:53:32.062 0 PECloseEngine 0 void IN 19 <==

|cc1e1032-5861-c7a4-7bed-f722ed54a177|2011 01 06 11:53:32:062|+0100|==| | |functions| 3756|1564|| ||||||||||||||||||||||0x61c 11:53:32.062 1 0 PECloseEngine 0 OUT void 19 <==

|02ea1021-f754-11d4-ea8d-8e8eb29a4e39|2011 01 06 11:53:32:078|+0100|==| | |functions| 3756|3412|| ||||||||||||||||||||||0xd54 11:53:32.078 0 PECloseEngine 0 void IN 0 <==

|e20ff076-98fd-5f54-fa05-69ec2f3d12aa|2011 01 06 11:55:12:093|+0100|==| | |functions| 3756|1564|| ||||||||||||||||||||||0x61c 11:55:12.093 0 PECloseEngine 0 void IN 0 <==

0 Likes

Hello,

Try moving the close and dispose to the forum unload method and comment them out in the subroutine itself. It should not be executing either until the printtoprinter method is finished so not sure why it's not working for you...

Question for you, did you create a c:\temp folder on your PC?

And what OS are you using, 32 or 64 bit?

Thank you

Don

Former Member
0 Likes

Hi Don,

My OS is WinXP SP3 but i have same problem with Windows 7 Ultimate - Both 32bit

Yes, i do have a C:\temp folder

I Just noticed that if i remove the close & dispose methods from my subroutine and then i close the form where the routine is placed then the reportdocument is closed fine (from log):

I Have waited 30 seconds beforee closing form - and no code has been written in the formclosed event

That's my code:

Private sub Test

Dim RptDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument

RptDoc.Load("C:\Report1.rpt")

RptDoc.PrintToPrinter(1, False, 1, 0)

End sub

Log file (diagnostic):

|b017cbc3-3828-4744-6950-64d66e0960b1|2011 01 06 16:59:14:125|+0100|==| | |Diagnostics| 2068| 640|| |0|0|0|0|CRPE.CRPEBackgroundThread|localhost:2068:640.20:1|-|-|CRPE.CRPEBackgroundThread|localhost:2068:640.20:1||||||||||||N/A:-1,Checking for data source changes,Elapsed Time,"0"

|94962ea8-2865-34a4-58e5-94248665ef29|2011 01 06 16:59:44:500|+0100|==| | |Diagnostics| 2068| 640|| |0|0|0|0|CRPE.CRPEBackgroundThread|localhost:2068:640.21:1|-|-|CRPE.CRPEBackgroundThread|localhost:2068:640.21:1||||||||||||..\..\src\print\datasource\datasrc2.cpp:535,Releasing subreport data sources,Start Time,"16:59:44"

|1a1f10bb-8be0-7664-9b0b-de8714a1d298|2011 01 06 16:59:44:500|+0100|==| | |Diagnostics| 2068| 640|| |0|0|0|0|CRPE.CRPEBackgroundThread|localhost:2068:640.21:1|-|-|CRPE.CRPEBackgroundThread|localhost:2068:640.21:1||||||||||||N/A:-1,Releasing subreport data sources,Elapsed Time,"0"

|64e76903-7252-fe84-d96d-68a02504591a|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:755,Closing engine,Start Time,"16:59:44"

|f0f0fd6b-e56b-18d4-aa90-788b19523611|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:797,Closing engine,Before close engine use count,"3"

|079a6377-072a-f534-f9a5-1af8ce61eabf|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:822,Closing engine,After close engine use count,"2"

|24099367-5f6c-40e4-b83a-6f888d3be4ce|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||N/A:-1,Closing engine,Elapsed Time,"0"

|888c3279-4e92-bfb4-285e-3c62f7389fa5|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|3872|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:755,Closing engine,Start Time,"16:59:44"

|4b6008c0-b5c9-b964-9a39-de7faab98979|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|3872|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:797,Closing engine,Before close engine use count,"2"

|e24fceb0-45b6-dc14-b85a-4953d4608451|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|3872|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:822,Closing engine,After close engine use count,"1"

|0df5892c-eb95-8184-8a02-d44bc3488e1c|2011 01 06 16:59:44:515|+0100|==| | |Diagnostics| 2068|3872|| ||||||||||||||||||||||N/A:-1,Closing engine,Elapsed Time,"0"

|95ff7794-3d78-7da4-bb6f-e2d9cfe221f6|2011 01 06 16:59:44:531|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:755,Closing engine,Start Time,"16:59:44"

|a17c9faf-71d6-6ac4-da09-4937dc513de7|2011 01 06 16:59:44:531|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:797,Closing engine,Before close engine use count,"1"

|4f8b4ddf-6ad0-fda4-6ba9-179435b5dec4|2011 01 06 16:59:45:015|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||..\..\src\crpe\crpe.cpp:822,Closing engine,After close engine use count,"0"

|7f396185-44d5-e6d4-9906-38e2c4e5ba54|2011 01 06 16:59:45:015|+0100|==| | |Diagnostics| 2068|2572|| ||||||||||||||||||||||N/A:-1,Closing engine,Elapsed Time,"491"

Edited by: gwadafu on Jan 6, 2011 5:14 PM

0 Likes

Hi,

Don't use c:\temp. For some reason our developers are using it also and it can cause problems. The known issue is the Database Expert can cause VS to crash if some specific file types are also in the temp folder.

I believe the issue is because the default for all OS's is the \users\temp folder they determined we can use it now and it's known to cause problems in CR for VS 2010.

Try renaming your temp folder to c:\mytemp and then test again.

I assume you did not change the default Users Environment variables correct?

Thank you

Don

Former Member
0 Likes

Thanks Don,

I renamed the c:\temp but no difference.

made no changes to envirnement variables

I made a new try:

- Main Form with a button to open Form1

- On Form1 code to print report (as posted before)

- I closed form1 and looked at CR log - still not closing jobs and temporary RPT file present with a new tmp file 1 KByte

- I closed Main Form and temporary RPT file and tmp file were deleted - and also found in log the jobs were terminated succesfully

Seems like there's something in the project that can be released only on when project stops !

But beleive me i have nothing on main form (it's an empty form wit a button)

The reason why i want to close & dispose the reportdocument class is cause i have an app running as a service on a server and noticed wjt the code below that i can print max 75 reports before crash (and i find 75 sessions opened on my Oracle server !)

Dim nRpt As Integer

Do

RptDoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument

RptDoc.Load("C:\Report1.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)

RptDoc.PrintToPrinter(1, False, 1, 0)

RptDoc = Nothing

nRpt += 1

Loop

Edited by: gwadafu on Jan 6, 2011 5:57 PM

0 Likes

Hello,

Is this a WEB or Windows app on the server?

Try adding GC.Collect to force Windows to release the objects.

No one else I recall is having this problem so it must be a environment specific to your system.

Use Process Monitor from Microsoft to see what is happening, could be a permission problem. If it's a WEB app then use something like Fiddler to see what those sessions are doing. If it is a WEB app then search on PostBack for sample on how to use it so you can close the session when the report is closed.

Thank you

Don

Former Member
0 Likes

Hi,

it is a windows app

I already tried with GC.Collect without results

The RPT file in %Temp% folder is deleted (and CR printer job cleared) only when i exit main form

former_member208657
Active Contributor
0 Likes

I see the same last 3 PECloseEngine calls in my logs as well, but they are all executed very quickly (all within 0.4 sec). Use Process Explorer to see what Crystal Runtime is being used when running your application. Ensure there isn't any mixed runtime from the beta. The beta files will be 14.x. The release version is 13.0.99.

Also use Process Monitor to see what your system is doing at the time of the PECloseEngine calls. Is it attempting to get access to a resource and is having issues? It is hanging on a network call?

These are some of the files that might show up as 14.x

boezlib.dll 14.0.0.760

ebus-3-3-2-7.dll 14.0.0.760

etc-1-0-12-6.dll 14.0.0.760

fssl-1-2-1-6.dll 14.0.0.760

icudt30.dll 14.0.0.760

icuuc30.dll 14.0.0.760

libOCAHelperw-5-0.dll 14.0.0.760

libOCASecurityw-4-0.dll 14.0.0.760

pvlocale-1-0.dll 14.0.0.760

xerces-c_2_7.dll 14.0.0.760

Edited by: David Hilton on Jan 6, 2011 10:14 AM

0 Likes

Ah... good to know.

So likely because for what ever reason the jobs won't close you are hitting that 75 job limit.

Is your project set to use the 4.0 framework and not the Client version?

Possibly also are you including the various CR components or just adding them to the projects references?

C# looks like this:

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

using CrystalDecisions.ReportAppServer.ClientDoc;

using CrystalDecisions.ReportAppServer.Controllers;

using CrystalDecisions.ReportAppServer.ReportDefModel;

using CrystalDecisions.ReportAppServer.CommonControls;

using CrystalDecisions.ReportAppServer.CommLayer;

using CrystalDecisions.ReportAppServer.CommonObjectModel;

using CrystalDecisions.ReportAppServer.ObjectFactory;

using CrystalDecisions.ReportAppServer.DataSetConversion;

using CrystalDecisions.ReportAppServer.DataDefModel;

using CrystalDecisions.ReportSource;

using CrystalDecisions.Windows.Forms;

Thank you

Don

Former Member
0 Likes

Thanks David & Don

My project is NET Framework 4 (not client profile)

i only refernce Crystal engine & shared

I ran process explorer but no entry with 14. has been found - i only have 13. version of CR running

I ran ProcessMonitor but can't see any error or what else

Only a NAME NOT FOUND for HKCU\Software\Classes\CLSID\{C41BC192-D73F-48F3-89A8-1A3698BA2D2B}

former_member208657
Active Contributor
0 Likes

CLSID{C41BC192-D73F-48F3-89A8-1A3698BA2D2B} is the class id for commonobjmodel.dll. But just because it came up as Name not found once doesn't mean it wasn't found in another location.

I'm out of ideas in this case. My next suggestion is for you to purchase some dedicated support because we've gone as far as we can here in the forums. [Purchase a Single Case|http://store.businessobjects.com/store/bobjects/Content/pbPage.CSC_map_countyselector/pgm.67024400?resid=jFmmLgoBAlcAAALO-iYAAAAP&rests=1278687224728].

Before you purchase support I suggest you remove and reinstall Crystal Reports for Visual Studio 2010. It's likely the first step we'd have you do in support anyways.

Former Member
0 Likes

Thanks for your help anyway

Will try to install both CR & VS2010 on a new pc and see ...

And if not working will purchase a case

Thanks !

0 Likes

One final note also...

Check the install log in C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\logging

And look for any dll's that could not be installed... Possibly you do have something running that is blocking a successful install to happen...

Thank again

Don

Former Member
0 Likes

Hi again,

got no errors in log ..

One think i didn't say is that i have same problem in 3 different PC where i developped my app and also all PCs where my app is installed has the same behaviour...

Thanks