TryFindSingle returns true and FindSingle throws exception

Class library usage, coding and language questions.
Geci
Posts: 22
Joined: Fri Sep 06, 2013 1:16 pm

TryFindSingle returns true and FindSingle throws exception

Post by Geci » Fri Sep 06, 2013 1:31 pm

Hi there,

I have the following problem:

TryFindSingle<T>("/element[@classname='ConnectUserControl']", out element) returns true (elemnt == null) but form.FindSingle<T>("/element[@classname='ConnectUserControl']") throws an exception (Ranorex.ElementNotFoundException: No element found for path '/element[@classname='ConnectUserControl']').

How is this possible?

Thank you for your help.

Greetings
Geci

Geci
Posts: 22
Joined: Fri Sep 06, 2013 1:16 pm

Re: TryFindSingle returns true and FindSingle throws exception

Post by Geci » Sat Sep 07, 2013 4:48 pm

Update:
In some cases TryFindSingle(...) returns false, but the out parameter is not null... ???

=> FindSingle<Unknown>("/?/?/element[@classname='ConnectUserControl']") returns an Unknown object but TryFindSingle<Unknown>("/?/?/element[@classname='ConnectUserControl']", out element) returns false (elment != null).

The application is a wpf application.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: TryFindSingle returns true and FindSingle throws exception

Post by Support Team » Sun Sep 08, 2013 8:29 am

Which Ranorex version do you use?
Geci wrote:TryFindSingle<T>("/element[@classname='ConnectUserControl']", out element) returns true (elemnt == null)
...
In some cases TryFindSingle(...) returns false, but the out parameter is not null... ???
...
How is this possible?
From the code of the current version (4.1.0), both cases are not possible. Are you 100% sure of your findings?

Regards,
Alex
Ranorex Team

Geci
Posts: 22
Joined: Fri Sep 06, 2013 1:16 pm

Re: TryFindSingle returns true and FindSingle throws exception

Post by Geci » Sun Sep 08, 2013 12:16 pm

I'm so sorry. I had a bug in my test. I had forgotten a !... Again sorry. You are the best :)

Best regards
Geci

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: TryFindSingle returns true and FindSingle throws exception

Post by Support Team » Sun Sep 08, 2013 1:42 pm

No problem, thanks for reporting back! :D

Regards,
Alex
Ranorex Team