Problem with Ranorex.Core.Resolver in 8.0.0

Ask general questions here.
Langrisser
Posts: 4
Joined: Tue Jun 21, 2016 1:53 pm
Location: Germany

Problem with Ranorex.Core.Resolver in 8.0.0

Post by Langrisser » Wed Jan 31, 2018 4:19 pm

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Ranorex.Core.Resolver, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. The system cannot find the file specified.
at __RxMain.__RxProgram.Main(String[] args)
Using Ranorex 8.0 on a test pc. The test runs start with a bat file, calling the project exe file. But for some time I am getting the mentioned exception.
I checked the cs file __RxPrograms.g. This file had the line "using Ranorex.core.Resolver".

Code: Select all

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using Ranorex;
using Ranorex.Core.Resolver;

namespace __RxMain
{
    public class __RxProgram
    {
        [STAThread]
        public static int Main(string[] args)
        {
            PrerequisiteChecker.WriteErrorToConsoleIfNotAvailable();
            AssemblyLoader.Initialize();

            RanorexInit();

            return MainInvoker.Invoke(Assembly.GetExecutingAssembly(), "", args);
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static void RanorexInit()
        {
            TestingBootstrapper.SetupCore();
        }
    }
}
Already tried:
https://www.ranorex.com/forum/problem-w ... 11289.html
https://www.ranorex.com/help/latest/vis ... ntegration

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by Vega » Fri Feb 02, 2018 8:39 pm

Can you please confirm that the Ranorex.Core.Resolver.dll exists in your output folder? I could also recommend using the "Copy runtime to output" option that is new in Ranorex 8. Go to settings --> check the checkbox labeled "Copy runtime to output". This will copy the entire runtime to your output directory as the name implies.

I know you are using a bat file to call your exe, please ensure that the Ranorex.Core.Resolver.dll exists in the same folder as the test executable you are calling.

Tomsk666
Certified Professional
Certified Professional
Posts: 33
Joined: Thu Mar 28, 2013 12:59 pm
Location: UK
Contact:

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by Tomsk666 » Mon Mar 19, 2018 2:37 pm

Hi Lagrisser, did you find a solution to this, as I have the same problem.
I'm using VS2017 and NUnit - my tests run fine in VS, but when I try to run them using the nunit console runner through the command line, I get the error you did:

1) Error : com.edgewords.ranorex.pom.Features.NavigationFeature.MainNavigation
System.TypeInitializationException : The type initializer for 'Ranorex.Core.ElementEngine' threw an exception.
----> System.BadImageFormatException : Could not load file or assembly 'Ranorex.Core.WinApi, Version=8.0.1.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. An attempt was made to load a program with an incorrect format.
at Ranorex.Core.ElementEngine.get_Instance()
at Ranorex.Host.get_Local()

Checked the output directory of my project in VS, and I have all the DLLs including the Ranorex.Core.Resolver.
I have also opened Ranorex 8.0 and set the setting for copy runtime to output directory as mentioned.
All works fine in Visual Studio, the problem is just when I run from the command line?

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by ahoisl » Mon Mar 19, 2018 8:57 pm

Tomsk666 wrote:System.BadImageFormatException : Could not load file or assembly 'Ranorex.Core.WinApi, Version=8.0.1.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. An attempt was made to load a program with an incorrect format.
The exception you get typically means that the 32/64 bit width (x86/x64/AnyCPU target) of the compiled executable does not match the Ranorex assemblies. Make sure that you use the correct Ranorex libs: for 32bit/x86 target use the assemblies from the Ranorex bin folder directly; for 64bit/x64/AnyCPU use the content of the "x64" subfolder within the Ranorex bin folder.

Or use the option Vega posted:
Vega wrote:check the checkbox labeled "Copy runtime to output". This will copy the entire runtime to your output directory as the name implies.
See more info here:
https://www.ranorex.com/help/latest/xcopy-deployment

Regards,
Alex
Ranorex Team

Tomsk666
Certified Professional
Certified Professional
Posts: 33
Joined: Thu Mar 28, 2013 12:59 pm
Location: UK
Contact:

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by Tomsk666 » Mon Mar 19, 2018 10:50 pm

Thanks Alex,
That sorted it, When I set the VS build configuration to target x86 it all works fine. Thank you

iamsethi
Posts: 1
Joined: Thu May 10, 2018 1:23 pm

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by iamsethi » Thu May 10, 2018 1:27 pm

I am working on Ranorex on 64 bit machine and i've followed below steps already
ahoisl
The exception you get typically means that the 32/64 bit width (x86/x64/AnyCPU target) of the compiled executable does not match the Ranorex assemblies. Make sure that you use the correct Ranorex libs: for 32bit/x86 target use the assemblies from the Ranorex bin folder directly; for 64bit/x64/AnyCPU use the content of the "x64" subfolder within the Ranorex bin folder.
but still I am getting this error

Test method KeePassTestSuite.CalculatorFeature.SquareRootOfANumber threw exception:
System.TypeInitializationException: The type initializer for 'Ranorex.Core.ElementEngine' threw an exception. ---> System.BadImageFormatException: Could not load file or assembly 'Ranorex.Core.WinApi, Version=8.1.1.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. An attempt was made to load a program with an incorrect format.

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by ahoisl » Sat May 12, 2018 9:11 pm

iamsethi wrote:I am working on Ranorex on 64 bit machine and i've followed below steps already
It is not about the machine, it is about the compiler settings you use.

Please, try creating a default Ranorex project with Ranorex Studio and see if that runs without problems.
If a default project does not run either, try reinstalling Ranorex using the self-extracting setup (not the MSI); it could be that you are missing some prerequisites (C++ redistributables) and those are installed by the setup executable.
If a default project runs smoothly, please check your compiler settings again. Thx!

Regards,
Alex
Ranorex Team