Page 1 of 1

Error When Running Executable File

Posted: Fri Mar 19, 2010 6:08 pm
by costamesakid
I set my Build Configuration to 'Release' and Rebuilt my Solution. I then was able to run the projects corresponding .exe file from the Release folder without any problems.

I then copied the entire Release folder to another computer with Ranorex installed and when I tried to run the .exe file Microsoft threw an error "...has encountered an error and needs to close".

What exactly is needed to run Ranorex .exe files on a system other than the system which the solution is built?

Thanks

Re: Error When Running Executable File

Posted: Fri Mar 19, 2010 7:16 pm
by Ciege
Can you run the exe from a command prompt to see if you can get more details about the error?

Do you have the same version of Ranorex DLLs on both machines?

Any machine difference? Different OS, different bit 32 vs 64?

Re: Error When Running Executable File

Posted: Fri Mar 19, 2010 9:49 pm
by costamesakid
The machines are definitely the same and so is the version of Ranorex. I tried to run it in a command line earlier and from what I recall the error was regarding not being able to find RanorexCore.dll.

I will copy and paste the error message here next time I am at the office. Thanks for your help.

Re: Error When Running Executable File

Posted: Fri Mar 19, 2010 9:54 pm
by Ciege
OK, send the exact error when you get a chance.

My guess is that the Ranorex dlls may not be the same version or are installed in a different location between computers. I have seen a similar message when I compiled a script on one machine with a particular version of the DLLs (2.1.x) then tried to run it on a machine with the 2.2 version of the DLLs. Ranorex installs 2.2 to a different location than 2.1.

Good luck...

Re: Error When Running Executable File

Posted: Sat Mar 20, 2010 2:45 am
by costamesakid
Does it make a difference where I place my 'Release' folder after I copy it over to the other machine? Thanks

Re: Error When Running Executable File

Posted: Sun Mar 21, 2010 6:15 pm
by Support Team
costamesakid wrote:Does it make a difference where I place my 'Release' folder after I copy it over to the other machine?
No, that should not make a difference (unless you use relative file paths inside your Ranorex code).

Please, post the error message that shows when you run your Ranorex executable from the command line! Do you have a try-catch clause around your Ranorex automation code in the Main method?

Try running Ranorex Spy or Recorder. If these two application don't start either, please try to reinstall Ranorex using the "Ranorex-2.X.X.exe" or "setup.exe" file, respectively! Maybe you did install Ranorex using the MSI package and a prerequisite is missing.

Regards,
Alex
Ranorex Support Team

Re: Error When Running Executable File

Posted: Tue Mar 23, 2010 8:20 pm
by costamesakid
Looks like Ciege was correct with his 1st response. The development system was running 2.2.2 and the runner system was running 2.2.1. Took me a second to figure it out because with the runner license I couldnt load Ranorex studio and view the version in Help > About. Thanks

This topic can be closed, but I have a related question that should probably be its own post. Anyway, I have code that prompts the user for an IP address. If the user clicks Cancel on the input dialog I terminate the program using "Thread.CurrentThread.Abort();". However, when I build in release mode and run the exe file, if the user clicks Cancel the program terminates, but Microsoft throws its own error "...has encountered an error and needs to close". Any ideas? Thanks

x = Interaction.InputBox("Enter The IP Address of your TOAD1 Interface","SUT IP Address","",300,300);
if (x == "")
{
MessageBox.Show("No IP Address Entered for TOAD1 Interface - Terminating Program");
Thread.CurrentThread.Abort();
}

Re: Error When Running Executable File

Posted: Tue Mar 23, 2010 10:29 pm
by Support Team
Don't use Thread.Abort to end your program. As its documentation describes (see http://msdn.microsoft.com/en-us/library/ty8d3wta.aspx), this method throws a ThreadAbortException. If you do not catch that Exception, your program will close with an unhandled exception and Windows will show an error dialog.

Use Environment.Exit instead or simply return from the Main method of your application.

Regards,
Alex
Ranorex Support Team

Re: Error When Running Executable File

Posted: Wed Mar 24, 2010 8:40 am
by costamesakid
Environment.Exit(-1);

Worked great for me. Thanks for the help.