Problem with Ranorex.Core.Resolver in 8.0.0

Ask general questions here.
Langrisser
Posts: 5
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: 164
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: 34
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: 181
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: 34
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: 181
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

alwaysonnet
Posts: 1
Joined: Thu Mar 07, 2019 5:52 pm

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by alwaysonnet » Thu Mar 07, 2019 5:55 pm

I am currently facing the same problem. I compiled the solution with Ranorex binary files copied to the Jenkins node. I have set TestExecution.CopyRuntimeToOutput in the ranorex settings file but MSBUILD doesn't create Runtime directory. Any thoughts?

Rima
Posts: 7
Joined: Thu Mar 07, 2019 8:17 pm

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by Rima » Thu Mar 07, 2019 8:46 pm

An unhandled exception of type 'System.TypeInitializationException' occurred in Ranorex.Core.dll

Additional information: The type initializer for 'Ranorex.Core.ElementEngine' threw an exception.


I have this problem in Ranorex 9.0
How did you guys fix it in yours?

I have added Bin folder dlls and then replaced with Bin\X64 folder dlls like Bootstrappped, core,plugins and common
What is remaining... or wrong?
I am trying to run the test in Visual Studio 15
using same version and license I can run in Ranorexstudio
But I want to run it on Visual Studio for certain data test

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

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by ahoisl » Thu Mar 07, 2019 10:04 pm

Rima wrote:
Thu Mar 07, 2019 8:46 pm
I am trying to run the test in Visual Studio 15
using same version and license I can run in Ranorexstudio
And Ranorex Studio is installed on the same machine?
When you open a solution with Ranorex Studio, it should correctly set up all references required and save the project. Afterwards you should be able to build/run the solution in Visual Studio as well.

If that still does not work, first try re-installing Ranorex.
Then take a look at the references linked in your projects in Visual Studio and if they point to the correct Ranorex installation directory.
And last, check the project you compile and see what the value for the "Ranorex_BIN_PATH" property is. Thanks!

What happens if you create a brand new project with Ranorex Studio and try to open & build/run that project with Visual Studio?
Rima wrote:
Thu Mar 07, 2019 8:46 pm
dditional information: The type initializer for 'Ranorex.Core.ElementEngine' threw an exception.
There should be some more information in that exception, specifically what DLL is not found.

Regards,
Alex
Ranorex Team

Rima
Posts: 7
Joined: Thu Mar 07, 2019 8:17 pm

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by Rima » Thu Mar 07, 2019 11:03 pm

:D Works when I create a project in Ranorex tool and open in Visual Studio 15
If i delete few files like abc.rxtmg , abc.rxtst , Repository.rxrep ,StartAUT.rxrec,Recording1.rxrec and CloseAUT.rxrec for clean folder structure my code doesnt work.

Can you recommend me which to keep and rest to delete?

I couldnt find Ranorex_Bin_Path in my (VisualStudiotool Project folder, and ranorextool Projectfolder and in Ranorex Bin Folder)

Where is this folder located?
I tried reinstalling Ranorex...didnt work :cry:

I have Ranorex tool and Visual studio on same Computer

Rima
Posts: 7
Joined: Thu Mar 07, 2019 8:17 pm

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by Rima » Fri Mar 08, 2019 3:07 pm

Thank you Alex

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

Re: Problem with Ranorex.Core.Resolver in 8.0.0

Post by ahoisl » Fri Mar 08, 2019 11:32 pm

Does that mean you were able to fix the issue? Would be great...

Regards,
Alex
Ranorex Team