Value dispose cannot be called while doing creaHandle()
I am running recorded script when my script reach to a form where we preview the report, once script click the Preview button
on the form I am getting this message "Value dispose cannot be called while doing creaHandle()" Please suugest me how to deal it.
Solved! Go to Solution.
What throws the error? Your application, or TestComplete. That's a pretty important detail!
Googling the error message suggests it may be a timing/sync issue.
In your test, try putting a hard coded delay of a few seconds before you click the preview button. The stuff I found in the google results suggest either a timing issue (most likely in this scenario) or the code that is doing this in your application is fundamentally broken as it's invoking close methods incorrectly (less likely as you don't mention it happening manually).
Hard coded delays are not great as they are not reliable. Searching for something within the application that indicates it's actually ready to preview would be a far better long term solution.
Acutally, It's testcomplete issue as I can able to preview the Report from form button on my application, but once I try through Script getting this message.
You didn't answer the question!
Yes. The error occurs when you do try and replicate the process using TestComplete.
But which application throws the error. The application under test, or TestComplete?
ie. Which one of the two is the error window attached to.
As I said. This is a pretty important detail!
OK. It's the application throwing the error.
So back to what I said in my initial post. Put a hard coded delay (not a good long term solution, but fine to debug this) before you try and generate the preview. If that fixes it, then it was a timing issue. Which the info I found googling the error suggested it might be.
The error implies it's trying to despose of an object it's still in the process of creating.
See here: http://stackoverflow.com/questions/2093087/form-dispose-or-close
... where it appears to be code structure related. But if it doesn't happen manually, the replies on there suggest it may be a timing issue.
You say it fails when you click the button to generate the preview.
Are you 100% sure it's happening on that EXACT step?
And I presume all this is trying to happen as fast as TestComplete can possibly go? You have no synchronisation or validation points to check if things are loaded/ready? No waits or delays? Nothing like that, it's just "do it as fast as you can". Which is not user-realistic. Obviously.
I ask as the replies on the above link suggest this error is thrown if you try and dispose of a form while it's still in the process of being created. So if you go into the panel. It loads data. You click "Preview" ..... and then what?
Do you inspect anything on the preview?
Do you just close it again?
If you just close it again, then the script should be stopping on that step as closing it causes the error as it tries to close the form before it's finished generating it.
If it's on the preview? I don't know. Does the preview rely on information within the main panel? But then it seems odd that this data would be destroyed to generate the preview. But it may .... I don't know as I don't know your application.
Either way, I suspect the devs may want to look at the code. Even if you did try and close the form at an inappropriate moment, the error handing within the application should handle it more gracefully than this. My test framework is more robust than this!
Or it may just be a bug in the application you're testing. Plain and simple.
Remember, the point of testing anything is to expose flaws. That's what testing is.
So when automated testing, your automated tests, ideally, should cope if the application starts failing and throwing errors at you.
Which yours is.
There's nothing wrong with TestComplete here.
The problem is either the application or your script. Or possibly a combination of the two.
But ideally, your script/test structure/framework should cope with this. Automated tests can run for hours. Mine do. Not much use if an application failure stops it in it's tracks 5 minutes in! If the application fails in mine, there is a failure routine it drops into which checks a series of things, types of crashes that can happen etc, and then tidies everything up, restarts things, logs all the appropriate info, and carries on.
If it just gave up and stopped, no-one would ever use my automated tests!
I much appreciate your valuable input in this matter. I try to clear you the scenerio, once I click the button before preview a Dialogue Box popup with YES and NO button, as I wanna go with these detail then I click yes button, Clicking YES button will show in a Report view currently throwing the issue "Value dispose cannot be called while doing creaHandle()".
I tried to put delay but it did not solve the issue. Still trying//
thank you so much, increasing delay to 55second resolved the issue. Report popup with details.
55 Seconds?!?!? That's a LONG delay!
If it needs a delay that long, then you must be able to cause this to happen manually if you press the "Preview" button too quickly?
That being the case, that seems like a bug in the application to me. It should leave the button disabled until it has enough data to generate the preview without causing this error ...