Page 1 of 1

InvalidOperationException after Form.Close()

Posted: Wed Jan 19, 2011 12:48 pm
by Ch_Ef
After using close() from class Form, i get an InvalidOperationException. But the form is closed after four seconds.
It seems that the response need to much time. Is it possible to increase this time?

System.InvalidOperationException: Failed to get response from control within 2000 milliseconds.
at Ranorex.Plugin.WinFormsFlavorElement.InvokeMethod(BindingFlags flags, String name, Object[] args)
at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args)
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)

Regards
Christian

Re: InvalidOperationException after Form.Close()

Posted: Wed Jan 19, 2011 3:52 pm
by Support Team
Hi,

in current version of Ranorex this timeout is not changable.
So you have to catch this exception by your own.

In the next major release 3.0 of Ranorex, which will be released soon, this timeout can be set by the user.

Kine regards,
Tobias
Support Team

Re: InvalidOperationException after Form.Close()

Posted: Wed Jan 26, 2011 10:32 am
by Ch_Ef
Fine.
Thanks for your answer.

Re: InvalidOperationException after Form.Close()

Posted: Fri Dec 30, 2011 10:58 am
by Pavlo
I'm using Ranorex 3.2 - how can I change that configuration value?
My test is failing because application need more time to close

-re
Pavlo

Re: InvalidOperationException after Form.Close()

Posted: Fri Dec 30, 2011 1:00 pm
by Support Team
The Control.InvokeMethod method provides a timeout argument. You can use this method to call the "Close" method on the respective form:
Form form = ...; // your form from the repository
Control control = new Control(form);
control.InvokeMethod(
	System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance,
    "Close", new object[] { },
    10000); // the timeout for this method in milliseconds
Regards,
Alex
Ranorex Team