Ranorex fails to run, system.TypeInitializationException

Bug reports.
jt1
Posts: 16
Joined: Fri Sep 25, 2015 4:18 pm

Re: Ranorex fails to run, system.TypeInitializationException

Post by jt1 » Tue Jun 07, 2016 6:57 pm

The problem is I can't do any debugging involving MailLogger because if it is referenced it crashes. I turned off Debug Just My Code, set a breakpoint and tried again but it still crashed. Now I will try the other Core.dll

Edit: Changing out the dll did nothing.

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

Re: Ranorex fails to run, system.TypeInitializationException

Post by Support Team » Tue Jun 07, 2016 10:18 pm

IMHO you see two separate problems.

When you debug in VS, click the "View Details..." link in the exception box and see all properties for the exception, especially the InnerException property. That should tell you what the real cause for the exception is.
My guess is that either some required DLLs are missing (e.g. in the output directory) or that you reference a wrong version of a Ranorex DLL.

It seems that when running using Ranorex Studio you get a different exception. That exception may be caused by a missing app.config file in the output directory, causing your MailLogger initialization to return null values.

Anyway, Ranorex Studio was able to get that far, so it might have corrected some of your DLL references. Have you tried opening the solution in Ranorex Studio and saving the solution and all projects?

Regards,
Alex
Ranorex Team
.
Image

jt1
Posts: 16
Joined: Fri Sep 25, 2015 4:18 pm

Re: Ranorex fails to run, system.TypeInitializationException

Post by jt1 » Wed Jun 08, 2016 3:35 pm

The InnerException pointed out a section of the app.config file that wasn't correct. I removed the section and Visual Studio is working again. Ranorex is still seeing the null value error, and I agree that this is an app.config problem still. I've been looking for where the path to locate the app.config file is stored but haven't had any luck. I'm hoping someone can tell me where that is, as it seems to be the root of the problem.

Edit
I had the code display the filepath of the config file using
Console.WriteLine(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
and they are not looking in the same place. When I run from Ranorex, the filepath is C:\Program Files (x86)\Ranorex 6.0\Bin\Ranorex.UiaLauncher32.exe.Config , while when run from VS the path is the config file contained in the project. I'm not allowed to edit the config file directly in Ranorex, so the question becomes what do you think I should do.

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

Re: Ranorex fails to run, system.TypeInitializationException

Post by Support Team » Mon Jun 13, 2016 2:32 pm

Hello jt1,

Usually, the application configuration file is located in the output folder of the project.

<Project>\bin\Debug\<executable name>.exe.Config

Furthermore, there should be an app.config file in the project directory. May I ask to check if those files exist?

Sincerely,
Johannes
.
Image

jt1
Posts: 16
Joined: Fri Sep 25, 2015 4:18 pm

Re: Ranorex fails to run, system.TypeInitializationException

Post by jt1 » Thu Jun 16, 2016 1:58 pm

There was no Debug folder in the <Project>\bin folder, so that config file does not exist. There is one in the project directory.

Thank you.

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

Re: Ranorex fails to run, system.TypeInitializationException

Post by Support Team » Mon Jun 20, 2016 3:39 pm

Hi jt1,

In order to analyze the issue, it would be helpful if you could send the compressed Solution to [email protected].

If the file is too large to be sent by email, please send an email to [email protected], too. Then, I will let you know the credentials for our ftp server.

Thank you in advance.

Sincerely,
Johannes
.
Image

jt1
Posts: 16
Joined: Fri Sep 25, 2015 4:18 pm

Re: Ranorex fails to run, system.TypeInitializationException

Post by jt1 » Fri Jun 24, 2016 6:26 pm

Hello Johannes,

After talking with my team we decided our solution contains too much sensitive information. We discussed sending it with the information removed but that may alter the solution enough to not be useful for your troubleshooting. What are your thoughts?

Thank you

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

Re: Ranorex fails to run, system.TypeInitializationException

Post by Support Team » Mon Jun 27, 2016 1:22 pm

Hello jt1,

That depends on which information exactly needs to be removed. As long as the issue remains reproducible with the solution, feel free to remove those parts from the solution. Alternatively, you could try creating a sample solution that illustrates the issue.

In regard to the sensitive information, we could also sign an NDA (Non-disclosure agreement) if it will be required from your side. May I ask to contact us by email to discuss the further steps?

I look forward to hearing from you.

Sincerely,
Johannes
.
Image