InvalidOperationException after Form.Close() : Automation API

InvalidOperationException after Form.Close()

Class library usage, coding and language questions.

InvalidOperationException after Form.Close()

Postby Ch_Ef » Wed Jan 19, 2011 1:48 pm

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
Ch_Ef
 
Posts: 4
Joined: Thu Nov 11, 2010 8:37 am

Re: InvalidOperationException after Form.Close()

Postby Support Team » Wed Jan 19, 2011 4:52 pm

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
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: InvalidOperationException after Form.Close()

Postby Ch_Ef » Wed Jan 26, 2011 11:32 am

Fine.
Thanks for your answer.
Ch_Ef
 
Posts: 4
Joined: Thu Nov 11, 2010 8:37 am

Re: InvalidOperationException after Form.Close()

Postby Pavlo » Fri Dec 30, 2011 11:58 am

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
Pavlo
 
Posts: 17
Joined: Fri Dec 30, 2011 11:55 am

Re: InvalidOperationException after Form.Close()

Postby Support Team » Fri Dec 30, 2011 2:00 pm

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
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests