InvalidOperationException after Form.Close()

Class library usage, coding and language questions.
Ch_Ef
Posts: 10
Joined: Thu Nov 11, 2010 7:37 am

InvalidOperationException after Form.Close()

Post by Ch_Ef » Wed Jan 19, 2011 12: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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: InvalidOperationException after Form.Close()

Post by Support Team » Wed Jan 19, 2011 3: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
.
Image

Ch_Ef
Posts: 10
Joined: Thu Nov 11, 2010 7:37 am

Re: InvalidOperationException after Form.Close()

Post by Ch_Ef » Wed Jan 26, 2011 10:32 am

Fine.
Thanks for your answer.

Pavlo
Posts: 43
Joined: Fri Dec 30, 2011 10:55 am

Re: InvalidOperationException after Form.Close()

Post by Pavlo » Fri Dec 30, 2011 10: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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: InvalidOperationException after Form.Close()

Post by Support Team » Fri Dec 30, 2011 1: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
.
Image