Ranorex runtime can't load an assembly while Studio can

Ranorex Spy, Recorder, and Studio.
schulle0815
Posts: 6
Joined: Fri Nov 25, 2011 11:19 am

Ranorex runtime can't load an assembly while Studio can

Post by schulle0815 » Wed May 09, 2012 1:04 pm

Hello support team,

we are experiencing a strange problem here related to a specific WinForms control (probably written in .NET 4.0) . When a recording that references this control is executed in the Ranorex Studio everything works fine (the control is found and can be manipulated be the recording). When the same recording is executed by just starting the compiled executable directly, the Ranorex runtime cannot find the control anymore, but displays the following error message instead:

Code: Select all

[Warn] [WinForms]: Failed to load the assembly containing the definition of this control. UI element identification capabilities for this control are limited. 
We already considered all the suggested solutions provided in the corresponding article from the knowledge base (http://www.ranorex.com/support/user-gui ... html#c3250).

The strange thing is: why does it work when the recording is executed right within Ranorex Studio? Do you have any hints regarding this? At the moment we are getting in contact with the guys who are providing us the DLL where the control is contained in. Do you have any further suggestions regarding the questions we could ask them in order to get to the source of the problem?

Thanks in advance and best regards,
Andreas Schulze

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

Re: Ranorex runtime can't load an assembly while Studio can

Post by Support Team » Thu May 10, 2012 9:46 am

schulle0815 wrote:We already considered all the suggested solutions provided in the corresponding article from the knowledge base (http://www.ranorex.com/support/user-gui ... html#c3250).
Are you sure you correctly added the "app.config" file to the test suite project as explained in "Reason #6"?

In order to automate .NET 4.0 controls, the automating process needs to be started with the .NET 4.0 runtime. The recorder does that automatically, but for your project, an app.config file is needed which specifies the runtime to use.

Regards,
Alex
Ranorex Team
.
Image

schulle0815
Posts: 6
Joined: Fri Nov 25, 2011 11:19 am

Re: Ranorex runtime can't load an assembly while Studio can

Post by schulle0815 » Thu May 24, 2012 8:58 am

Ok,thanks for the hint. The app.config is part of the testsuite project. At the moment we are doing a workaround that uses image recognition and therefore avoids loading the .NET 4 assembly. So for now the problem is solved :) .

schulle0815
Posts: 6
Joined: Fri Nov 25, 2011 11:19 am

Re: Ranorex runtime can't load an assembly while Studio can

Post by schulle0815 » Mon Jun 25, 2012 3:02 pm

Just for the record: the source of our problem was that the DLL that should be automated was build with .NET 4, but our Ranorex project was set to the .NET 3.5 as the target framework. Switching the Ranorex project to .NET 4 appeared to be the obvious solution, but it caused us some headaches.

After setting the project to .NET 4 we could'nt compile the project on our system under test setup anymore and got a lot of strange compiler errors like "The reference assemblies for framework ".NETFramework,Version=v4.0" were not found." or "Parameter "SearchPaths" has invalid value "{CandidateAssemblyFiles}%3b%3b". Re-Installing .NET 4 or the current Ranorex version did not solve this issue.

The solution was to install the "Microsoft Windows SDK for Windows 7 and .NET Framework 4" on the system under test. Now we are able to compile .NET 4 Ranorex projects and the automation also works as expected.