Cannot Run Code Module but Can run from Suite and Executable

Ask general questions here.
erikjwagner
Posts: 4
Joined: Thu Oct 15, 2015 8:12 pm

Cannot Run Code Module but Can run from Suite and Executable

Post by erikjwagner » Thu Aug 24, 2017 4:28 pm

Hi,
I have a test that, when I made it, ran fine from a code module via the iTestModule.Run method. I added it to a test suite and deployed the test executable. Later, I had to make a change to the repository (i.e. not a functional code change) and when I attempted to run the code module I started getting this error

System.TypeLoadException: Could not load type 'UmbrellaHeartbeat.TestCases.DevHeartbeat' from assembly 'UmbrellaHeartbeat, Version=1.0.6421.20897, Culture=neutral, PublicKeyToken=null'.
at TempB3BD6E8.CodeModuleRunner.Run(String[] args)
at TempB3BD6E8.CodeModuleRunner.Main(String[] args)

At this point the project compiles. I can run this test from the test suite and it runs from the test executable. Just not from the code module. My understanding is that the TypeLoadException typically refers to trying to use a higher framework than you're supposed and I checked this, all frameworks are .net 4.0. All references exist and the non windows/ranorex references (i.e. the ones that I actually added) are pointing to 4.0 as well.

I'm unsure whether this question 'belongs' in the general area. None of the other areas looked obvious so I thought I would start here.

Edit: I forgot to add, my code runs on other machines. Other code modules in different projects run fine, so this leads me to believe it is something wrong with how my project is configured.

Thanks for any help/insight
Regards
Erik

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

Re: Cannot Run Code Module but Can run from Suite and Executable

Post by Support Team » Fri Aug 25, 2017 2:34 pm

Hello Erik,

This is not a common issue, but it seems to be related to the assembly you are loading. Unfortunately, without having your Ranorex Solution it is some kind of difficult to analyze the issue because there are a lot of reasons why this could happen. You already wrote that you checked the version of the .NET Framework. Another thing you can check is the bit version of the assembly (x64 or x68).

If this also doesn't help we would need your project in order to do a deeper analysis.

Sincerely,
Bernhard
.
Image

erikjwagner
Posts: 4
Joined: Thu Oct 15, 2015 8:12 pm

Re: Cannot Run Code Module but Can run from Suite and Executable

Post by erikjwagner » Fri Aug 25, 2017 2:54 pm

Bernhard,
I actually did check that (sorry, I have checked so many things it was hard to recall them as I was writing that). I have the configurations set up and all projects were x86 (I switched it to x64 just to be sure but that didn't remedy it).
Believe me I would love to post the solution here but unfortunately cannot for a host of reasons. I was just hoping describing my problem might ring a bell for someone and they'd have tried something I had not.
For the moment it isn't the end of the world, since I can still run them via the suite and the exe i'm not dead in the water but it is just a baffling and frustrating problem.
Thanks for the reply and thoughts.

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

Re: Cannot Run Code Module but Can run from Suite and Executable

Post by Support Team » Mon Aug 28, 2017 11:32 am

Hi Erik,

Thank you for your reply. I'm sorry that my suggestion didn't help. In order to analyze the issue in more detail, I would need your Ranorex Solution or a sample solution where I can see the issue.
Would you mind sending it to [email protected]?

You can find a description how to create a compressed Ranorex Solution in you user guide.

Sincerely,
Bernhard
.
Image