Class_terminate gets stuck
Does anyone ever run into this? I have seen it going back to QTP 10. It still happens on UFT 12.02.
I set up the code for watching for the end of the script or The user pressing the Stop button.
The code goes to the Class_Terminate method. it reaches something that has an error.
A MS Debug window appears. it is not part of UFT. I see it stuck on a line of code either for something simple such as
cat = 1
something that can really be an error such as
Then it gets stuck.
I think that when using F10 to step through code sometimes there is an error. UFT wants to stop but it gets hung up in Class_Terminate but I don't see the Debug window in these cases. I'm just guessing that it gets stuck here.
My workaround is to but
On Error Resume next at the start of Class_Terminate.
Also if Class_Terminate is calling other funcitons, I have to put it in the places it calls which is mostly closing Excel, FileSytemObject and other cleanup activities.
Am I alone in seeing this happen?
Hi Kevin ,
Check this whether it helps
Class terminate will be called when u destroy a instance of a class . When we declare a Class we have two methods . one is Class_Initialize and another one is Class_Terminate . Initialize will be called when you initialize the class Like set obj= new ClassA.Class Terminate will be called when you destroy the created object . Set obj = nothing
I appreciate the information.
With the assistance of this forum I got all of the parts working. I could go back to earlier posts if we need to see how to do this. It is all working except that sometimes When the Stop button is used or the script gets to the end and reaches the class_terminate code a debug window from MS appears. it is not the UFT debug window. It does show the UFT VBSCript code that I created. While it is executing the code in Class_terminate it hits a line and gets stuck. Then UFT is also stuck. I can give this Debugger focus by clicking on it. Then it uses F8 and Shift F8 in the same way that MS Excel VBA works. I can also use the triangle on its menu to keep running. I often gets stuck about 3 times before going back to UFT. Then I get control back. I think sometimes the debugger is activated and hidden that is why UFT freezes(maybe). I find that putting ON ERROR RESUME NEXT at the top of Class_terminate and functions that it calls stops the freezing. I was wondering if others see this window. I have encountered it back to at least QTP 11.0.