Ranorex not launching app as admin

Ranorex Studio, Spy, Recorder, and Driver.
dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Thu Dec 02, 2021 10:27 pm

Ok, so here is where I am.

I runs "sometimes". I don't know why sometimes it gets that error, but it ran 4 times yesterday when it didn't. I am not changing anything, I am simply redeploying the release.
noError.png
Finds the checkbox, unchecks it and runs.
error.png
Can't find the checkbox and fails.


Literally nothing has changed. I am using the same release, just redeploying. Sometime Ranorex feels like it doesn't have rights when nothing has changed.
You do not have the required permissions to view the files attached to this post.

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Tue Feb 08, 2022 5:04 pm

So, after all that.

Here is the offending line of code:

Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'ApplicationUnderTest.ToolStripContainer1.CbxSelection' at Center.", repo.ApplicationUnderTest.ToolStripContainer1.CbxSelectionInfo, new RecordItemIndex(3));repo.ApplicationUnderTest.ToolStripContainer1.CbxSelection.Click()
;Delay.Milliseconds(0);


The issue is that Magic Merger for whatever reason stripped out the try/catch for this section. Here is the recreated section that now works correctly.

try {
Report.Log(ReportLevel.Info, "Mouse", "(Optional Action)\r\nMouse Left Click item 'ApplicationUnderTest.ToolStripContainer1.CbxSelection' at 12;9.", repo.ApplicationUnderTest.ToolStripContainer1.CbxSelectionInfo, new RecordItemIndex(5));
repo.ApplicationUnderTest.ToolStripContainer1.CbxSelection.Click("12;9");
Delay.Milliseconds(0);
} catch(Exception ex) { Report.Log(ReportLevel.Warn, "Module", "(Optional Action) " + ex.Message, new RecordItemIndex(5)); }


So after recreating the steps, allowing Ranorex to generate the code, it now works. So the symptom was that Ranorex was not starting the application with appropriate rights, the real issue was the try/catch that Ranorex expected wasn't there and when an error occurred, things went sideways. So after 2+ months, numerous emails, calls, conferences with Ranorex, all I had to do was rerecord the uncheck of the box.

Thanks Magic Merger, you are truly magical.

:lol:

kuchlog25
Posts: 2
Joined: Thu Jun 30, 2022 9:32 am

Re: Ranorex not launching app as admin

Post by kuchlog25 » Thu Jun 30, 2022 9:33 am

I created a Release pipeline using most everything from the build pipeline, only it doesn't create a build, it used the last successful build. It runs the installer just fine, but it fails when it launches the app. It's no different than how it launches the app for the BVT.

kuchlog25
Posts: 2
Joined: Thu Jun 30, 2022 9:32 am

Re: Ranorex not launching app as admin

Post by kuchlog25 » Mon Jul 04, 2022 7:46 pm

I created a Release pipeline using most everything from the build pipeline, only it doesn't create a build, it used the last successful build. It runs the installer just fine, but it fails when it launches the app. It's no different than how it launches the app for the BVT.
hellodear.in

teatv.ltd

Baxter
Posts: 11
Joined: Wed Jun 29, 2022 10:03 pm

Re: Ranorex not launching app as admin

Post by Baxter » Mon Oct 03, 2022 11:51 pm

There could be many reasons for this error. In my case, this error was intermittent on about 5 of the 25 identical VM's we run our nightly test on. on the error VM's i found the following in the event viewer:

Faulting application name: LicensingAdminConsole.exe, version: 1.4.0.4, time stamp: 0xec24c8d7
Faulting module name: Ranorex.InjectionBootstrapper32.dll, version: 10.2.2.0, time stamp: 0x62a064d4
Exception code: 0xc000041d
Fault offset: 0x00015f4c
Faulting process id: 0x107c
Faulting application start time: 0x01d8d6d2a13ebc6b
Faulting application path: C:\Program Files (x86)\xxx\xxx\LicensingAdminConsole.exe
Faulting module path: C:\Users\Public\Documents\xxx\Runtime\Ranorex.InjectionBootstrapper32.dll
Report Id: 4f864be6-8ded-4453-8d85-c39b4f9c799b

running Ranorex 10.2.2 using jenkins agent (ranorex not installed on the VM, using runtime folder with all the ranorex dll's). I added some code that reports the elevated state of the Ranorex EXE, and it is in fact elevated when the failures occur:

public void IsElevated()
{

WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
Report.Info( "Process is elevated = " + principal.IsInRole(WindowsBuiltInRole.Administrator).ToString() );

}

What I believe is causing our AUT to crash is Ranorex is injecting into the application too early(performance issue of our app perhaps) and causing it too crash. I added a 10 second delay after starting the AUT to make sure Ranorex is not interactingthe AUT when it's not ready. If this doesn't work I will have to create a ticket with support to find out why our AUT crashes sometimes when being automated by Ranorex.