Exception when finding a Form from Host.Local

Bug reports.
User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Exception when finding a Form from Host.Local

Post by Ciege » Fri Feb 05, 2010 12:08 am

I've only seen this once so far but will keep an eye out for it and try to get specific reproduction details.

When executing this line of code (which by the way has been run tens of times during a test pass)

Code: Select all

HDForm = Host.Local.FindSingle("/form[@title='" + WindowName + "' or @controlname='" + WindowName + "']", (Timeout * 2) * 1000);
I was presented with this exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Ranorex.Core.CacheSession.set_Item(CacheId id, Object secondaryKey, Object value) at Ranorex.Core.Element.IsEqual(Element elem) at Ranorex.Core.Element.Equals(Object obj) at System.Collections.Generic.ObjectEqualityComparer`1.IndexOf(T[] array, T value, Int32 startIndex, Int32 count) at System.Array.IndexOf[T](T[] array, T value, Int32 startIndex, Int32 count) at System.Collections.Generic.List`1.IndexOf(T item) at Ranorex.Core.ElementEngine.ApplyGlueRules(Element element, GlueRuleExecutionState state) at Ranorex.Core.ElementEngine.ApplyGlueRules(Element element) at Ranorex.Core.Element.GetChildren(CacheSession session) at Ranorex.Core.Element.get_Children() at Ranorex.Core.RxPath.collectAxis(LocationStep step, Axis optimizedAxis, Element self, IList`1 elements, Boolean quitOnFirstGoodNode) at Ranorex.Core.RxPath.ApplyInternal(RxPath path, Element startElement, IDataProvider dataProvider, Duration timeout, Boolean findSingle) at Ranorex.Core.Element.FindSingle(RxPath path, Duration timeout) at Ranorex.Adapter.FindSingle(RxPath path, Duration timeout) at RanorexFramework.RFW.WaitForWindow(String WindowName, Int32 Timeout) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\RanorexFramework\RanorexFramework\Class1.cs:line 4072 at RanorexFramework.RFW.ReportPrint(Form HDReportsForm, ReportPrintOptions MyReportPrintOptions, Boolean boolCloseReportsDialog) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\RanorexFramework\RanorexFramework\Class1.cs:line 7993
This is on an XP32bit box with SP3 using Ranorex version 2.1.4.6779.

I'll post more info when/if I find more details.

Thanks...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Exception when finding a Form from Host.Local

Post by Support Team » Fri Feb 05, 2010 9:26 am

Do you have multiple threads running in your Ranorex application? If so, then the cause for this exception is most likely a race condition in the Ranorex Element class. We fixed that race condition in version 2.2.1, so please update to that version! Thanks!

Regards,
Alex
Ranorex Support Team
.
Image

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Exception when finding a Form from Host.Local

Post by Ciege » Fri Feb 05, 2010 4:04 pm

Indeed I do have multiple threads running. The main thread and a second thread checking for any potential unhandled exceptions from the AUT.
I'll get to upgrading to the new version of Ranorex as soon as I can.

Thanks!
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...