Ranorex fails to start when attempting to use external dll

Ranorex Studio, Spy, Recorder, and Driver.
EmirT
Posts: 2
Joined: Wed Oct 20, 2021 2:33 pm

Ranorex fails to start when attempting to use external dll

Post by EmirT » Wed Oct 20, 2021 3:09 pm

Hello,

I am using Ranorex 10.1.1 version on Windows 10 Pro - 64 bit (OS build: 19042.1288). I successfully created a Test case that works on Revit using the element obtained using Ranorex Spy and steps obtained using Ranorex recorder. However, when I try to incorporate working Revit API methods implemented in Visual Studio into Ranorex, I get the following error in the console which appears for a brief moment and run stops.

Solution is set to use .Net Framework 4.8.0 and C# 5.0
RanorexErrorStartRefrelction.png
RanorexErrorStartRefrelction.png (361.76 KiB) Viewed 519 times
As soon as I comment out any methods from Revit API library which were added as references (sam as in visual studio), Ranorex runs without an error.

Sample code:

Code: Select all

using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Repository;
using Ranorex.Core.Testing;

using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.ApplicationServices;

namespace MyTest
{
    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    public partial class Recording1 : IExternalCommand
    {
    
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {

            TaskDialog.Show("Test", "Successful");

            return Result.Succeeded;
        }
	
        private void Init()
        {
            // Your recording specific initialization code goes here.
        }

    }
}
Based on the information I managed to get online, I enabled Copy runtime to output option and removed all Ranorex references that my project does not need at the moment. But that did not help me in resolving the issue. I still get the same error.

When I comment out remove :IExternalCommand from the class Recording1 above, I get a report with the following error:
AssembliesError.png
AssembliesError.png (43.86 KiB) Viewed 516 times

EmirT
Posts: 2
Joined: Wed Oct 20, 2021 2:33 pm

Re: Ranorex fails to start when attempting to use external dll

Post by EmirT » Wed Oct 20, 2021 9:29 pm

After I changed Target CPU to 64-bit Intel-compatible processor in Project options for Compiling, the error changed to the one shown below:
ErrorOnLoadingAssemplies.png
ErrorOnLoadingAssemplies.png (36.12 KiB) Viewed 504 times