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

Can't close Reportdocument class

Former Member
0 Likes
1,596

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

Hi again,

i just realized that the process works fine on Windows 7 and Windows Server 2008 OS

I only have problem on XP machine.

Even if i compile project on my XP development machine that will work on Win7 and Server 2008 - but crashes in debug, while debugging works fine on windows 7

Can be a Win XP issue ?

Will wait a few days and then open a call ...

Thanks

former_member208657
Active Contributor
0 Likes

Believe it or not, but it is good that it fails on one OS and works on another. It gives you something to compare. Use tools like Process Explorer and Modules to compare the runtime environment for the application. You'll want to concentrate on what is different or missing on the Windows XP system.

Links

[Modules|https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip]

[Process Explorer|http://technet.microsoft.com/en-us/sysinternals/bb896653]

Former Member
0 Likes

Hi again,

I finally bought a single case but still waiting for solution ...

meanwhile i found the problem myself ... should not have paid for it

On my XP development machine and on all clients I have registered two Crystal Reports User Defined Function, DLLs made by me in VB6 to have functions in CR

The first Crufl named CruflNss.dll has been made for reports written in CR 8.5

The second Crufl named Crufli.dll has been made for reports written in CR XI

I created an XP virtual machine and installed Net framework 4 and CR runtime engine 13

app was running fine

I registered CruflNss on XP Virtual machine and application was fine

I registered Crufli on XP Virtual machine and application hangs !

So, back to my development machine:

I opened VS2010 project in debug

I opened CruflNss project in VB6 debug and run step by step

I opened Crufli project in VB6 debug and run step by step

I launch my app

I click on load report in viewer

Event class_initialize is raised in CruflI

Event class_initialize is raised in CruflNss

Event class_terminate is raised in CruflNss

And again (twice)

Event class_initialize is raised in CruflI

Event class_initialize is raised in CruflNss

Event class_terminate is raised in CruflNss

The report is shown

I click on close

Event class_terminate is raised in Crufli (twice)

And app closes fine (in DEBUG only)

I found the code that seems to hangs

I removed ALL code from Crufli.DLL (the one that hangs) and just let this code on class (nothing else)

Option Explicit

Public Property Set MyObj(TestObj As Object)

End Property

In debug all is fine. If I compile the crufl DLL app hangs

If I change code to:

Option Explicit

Public Sub SetMyObj(TestObj As Object)

End Property

All works fine in debug & compiled

The reason why I have 2 Crifl is that Crystal reports ActiveX Designer Runtime Library 8.5 accepts a sub

but Crystal reports ActiveX Designer Runtime Library XI seems not to accepts sub (thatu2019s why I created a public property)

Actually my real code assign a connection to the DLL

In CR XI:

Public Property Connection (oCnn As ADODB.Connection)

End Property

In CR 8.5:

Public Sub SetConnection (oCnn As ADODB.Connection)

End Property

In code outside the DLL i use:

Dim oCrufl as new Crufli.clsLib

Set oCrufl.Connection = MyConnection

if I change Property into a sub then call oCrufl.SetConnection(oCnn) i get a u2018Type Mismatchu2019 error

0 Likes

Hello,

If this is a bug then you can get a refund for your case. If it's by design or how .NET works then not likely.

Thank you for the update.

Don

former_member208657
Active Contributor
0 Likes

If you logged a case and found the answer before you spoke with an engineer you can get a refund. But if you've already started collaborating with one of our engineers we won't issue a refund. The only exception is if it is logged as a bug with our product (as Don mentioned).

Former Member
0 Likes

My goal is not to obtain a refund, but to solve my problem, and the engineer has not been able to.

I had to solve it myself.

If i have a problem in Windows XP and the engineer answer me:

"Do let me know the details, your observations and as I have a Win 7 environment I would be testing the same at my end, in the meantime."

He will surely never be able to reproduce the problem in windows 7 if i told him in 7 was fine but the problem is in XP.

And, if i told him i was using a CRUFL and the engineer writes me:

"I checked the Crufli.dll at my end and could not find one. Since itu2019s not provided with Crystal, we will not be able to work on it."

That means the engineer doesn't even know what a CRUFL is, cause he surely cannot find at his end a Crufl developed by me !!!

I'm very very disappointed with SAP support.

But not with this forum

0 Likes

What is the case number?

Former Member
0 Likes

Case n. 360990

And i discovered this morning that the use of three different CRUFL was in the log of process explorer i sent to the engineer, but seems not to be seen by him !

0 Likes

Hello,

Just to be clear you told Atanu to close the case and he did test it on XP but could not duplicate the issue. And from your notes yes you did discover the cause a few times but it's not that clear....

I think what the problem is is you are mixing technologies, VB COM and .NET COM.

Can you search for this kbase article and download the sample .NET CRUFL and re-build your UFL using the updated functionality?

1525014 - Sample .NET UFL and Localization Formula function

I believe the problem is likely due to having CR 8.5 and 2010 UFL's in the same instance. CR will load both, it won't be version specific because they are COM. CR 8.5 uses the legacy u2lcom to bridge COM and the dll and .NET will use the new u212manager.dll to bridge .NET COM UFL's and CR 2010.

Also CR 8.5 is not side by side compatible nor is it supported. Side by Side CR support started with CR 9 and VS 2002 which was also based on CR 9 runtime.

As a test, unregister your CR 8.5 UFL and run your app again. Then update your UFL to use the new .NET version sample.

Thank you

Don

Former Member
0 Likes

Thanks Don for your answer ... this is what i call a SUPPORT !

The pc where my apps are running are supposed to use both VB6, CR 8.5, CR XI, CR4VS2010 and VS2010

This is something i cannot change 'on the fly' and i'm sure you can understand why ...

I have 2 crufl installed as when we moved some reports from 8.5 to XI i noticed that CR XI engine did not support a public sub like this:

Public Sub SetConnection(ByRef oCnn as ADODB.Connection)

(the code i used in Crufl for CR 8.5) - in CR XI i get a type-mismatch error when setting the connection

I needed to change the code and use a public property:

Public Property Set Connection(ByRef oCnn as ADODB.Connection)

Now the latest application written in VS2010 seems to have problems with this property and CR hangs on closing reportdocument class.

I modified the Crufl passing the connection string and then open connection (and works fine)

Public Sub SetDbLink(ByVal DbLink as String)

I still do not know why i get the type-mismatch error ... (and i also tried re-naming the property)

Do you know another way to pass a connection to the Crufl or let the Crufl use the report connection ?

(i need a connection in my Crufl cause i need to look-up in DB tables not included in the report tables - ifor exemple i need to translate labels from DB according to a specific field in the report)

Can i re-write a one and only CRUFL in .NET and use in both CRXI reports and CR 8.5 reports ?

Thanks

0 Likes

Hello,

It doesn't matter if you can change it or not, CR doesn't support that configuration so if you have issues there is nothing we can do to fix it or for that matter debug the cause. CR 8.5 will not share CR runtime so it is likely loading the other UFL and causing issues.

CR 8.5 isn't .NET aware so I doubt one UFL for both will work.

Use the sample from the kbase I posted for .NET app and update your .NET UFL and run your CR 8.5 app/reports on a different PC. They won't work together from your description so you have no choice.

Thank you

Don

Former Member
0 Likes

Thanks all for your posts

I finally solved it in a surely NON-CONVENTIONAL way:

If iNetLib.clsFunctions.GetOSVersion = "WinXP" Then

' Unregister DLL

sOperation = "REGSVR32 """ & "C:\Programmi\File Comuni\iLogic-Software\ActiveX Dlls\Crufli.Dll" & """ -u -s"

Shell(sOperation)

End If

RptObj.Close

RptObj.Dispose

If iNetLib.clsFunctions.GetOSVersion = "WinXP" Then

' Register DLL

sOperation = "REGSVR32 """ & "C:\Programmi\File Comuni\iLogic-Software\ActiveX Dlls\Crufli.Dll" & """ -u -s"

Shell(sOperation)

End If

amit_nath
Explorer
0 Likes

Hello,

I am working on setting up a UFL. We are using CR 2010 SP1. We need the UFL to do a look up on the database and return data to the report. We are using OLEDB connection in our Crystal reports. I wanted to know, how we can pass the connection information to the UFL. I see, this has been mentioned in the forum. Could you provide the insight on how to pass connection info the UFL from Cystal Report ?

Thanks,

Amit

Former Member
0 Likes

Amit

1) This thread is set as "Answered"

2) Your query has nothing to do with the content of this thread

3) You created another thread here:

Please do not attach posts to "answered" threads that have nothing to do with the thread.

For the future, I recommend you have a look at the [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]...

- Ludek