.NET Framework Initialization Error

Ask general questions here.
BPyles
Posts: 5
Joined: Thu Feb 25, 2010 10:21 pm

.NET Framework Initialization Error

Post by BPyles » Thu Feb 25, 2010 10:43 pm

I am running the Ranorex trial version (2.2.2.7850).

XP Professional version 2002, service pack 3. Have been developing for some time in C# on this machine using Visual Studio 2008 with no problems. .NET Framework 3.5 SP1

I have built an executable as described on page 15 of the Ranorex tutorial. When I run the executable it is getting the following error.

.NET Framework Initialization Error - Unable to find a version of the runtime to run this application.

I will greatly appreciate any help in getting this resolved.

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: .NET Framework Initialization Error

Post by Support Team » Fri Feb 26, 2010 6:25 pm

Could you please post the complete text of the exception? Right now I can only guess what the problem is.

Do you have problems starting other .NET applications, too, or just when starting Ranorex executables? Are you able to start Ranorex Spy, Recorder or Studio?
Do you have a Beta version of the .NET Framework or Visual Studio installed?
Do you have a configuration file for your EXE (*.exe.config) that limits the required target framework to a distinct .NET Framework version?

Regards,
Alex
Ranorex Support Team
.
Image

BPyles
Posts: 5
Joined: Thu Feb 25, 2010 10:21 pm

Re: .NET Framework Initialization Error

Post by BPyles » Fri Feb 26, 2010 6:36 pm

That is the complete text in the dialog box.

When I just double click on the exe a DOS command window quickly opens and closes. When I right click and run as current user, that is when the error occurs.

Is the DOS window flashing the proper behavior for the double click.

No problems with other .NET applications. The Ranorex Studio, spy etc seem to be working fine. No config file for the exe.

I dont believe there are any beta framework or Visual Studio. Using Visual Studio 2008 as described.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: .NET Framework Initialization Error

Post by Support Team » Fri Feb 26, 2010 6:56 pm

BPyles wrote:That is the complete text in the dialog box.
Please, open a Windows command line window and try running the application from there. This may give you a more detailed exception message.
BPyles wrote:When I just double click on the exe a DOS command window quickly opens and closes. When I right click and run as current user, that is when the error occurs.
I don't understand, double-clicking an executable and running the executable as current user (using the context menu) does exactly the same. Why should one operation cause an exception?
BPyles wrote:Is the DOS window flashing the proper behavior for the double click.
If you created a default Ranorex Automation or console project and did not add any code or recorded any actions in the recording, then the executable will not do anything but opening the "DOS box" and closing again.
BPyles wrote:The Ranorex Studio, spy etc seem to be working fine.
If Ranorex Studio works fine, there is something wrong with your project. Did you use the default Ranorex project template, i.e. did you create your executable by creating a Ranorex Automation project in Ranorex Studio?

I guess that there is an unhandled exception in your executable, that's why Windows shows the error. Try debugging your application!

Regards,
Alex
Ranorex Support Team
.
Image

BPyles
Posts: 5
Joined: Thu Feb 25, 2010 10:21 pm

Re: .NET Framework Initialization Error

Post by BPyles » Fri Feb 26, 2010 10:14 pm

Thanks for the help.

the exe runs from the command line window, no errors as it does with a double-click. So, the question now is what is it supposed to do? Is it supposed to apply the test to the VIP Database application window which is open ? It does not, it appears to do nothing.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: .NET Framework Initialization Error

Post by Support Team » Mon Mar 01, 2010 4:02 pm

You are trying the tutorial right?
Is it possible that @Program.cs of your Ranorex Project the wrong Recording is called.

Check the following line in the Program.cs
try
{
    //TODO: Code here - for example:
    Recording1.Start();  //Check if this compares with your Recording name.
}
Also take a look at the first video ("How to Run Multiple Recordings") on following link http://www.ranorex.com/support/screencasts.html

Regards,
Peter
Ranorex Support Team
.
Image

BPyles
Posts: 5
Joined: Thu Feb 25, 2010 10:21 pm

Re: .NET Framework Initialization Error

Post by BPyles » Mon Mar 01, 2010 5:39 pm

Alex,

That fixed it. The line Recording1.Start(); was not in the code.

Thanks