BUG: inheritied class causes exception

Bug reports.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

BUG: inheritied class causes exception

Post by odklizec » Tue Jan 14, 2014 4:47 pm

I'm afraid, the latest 4.1.4 don't like me at all. I just found another problem I did not experience before. I can reproduce it on two independent machines with installed 4.1.4.

Here it is...
RXException.png
RXException.png (173.46 KiB) Viewed 886 times
Here is the whole error message:
Can not intercept exception. Debugged program can not be continued and properties can not be evaluated for :
System.TypeInitializationException: The type initializer for 'InheritanceError.Recording1' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Temp1B2B5212.RecordingRunner.Run
at Temp1B2B5212.RecordingRunner.Main
STEPS TO REPRODUCE:
- Unpack the attached project
InheritanceError.zip
(48.82 KiB) Downloaded 115 times
- Load the project and then simply run the Recording1.rxrec >> an exception is thrown

The only way how to "fix" this exception is to remove the inheritance in Recording1.UserCode.cs
RXException_1.png
RXException_1.png (322.06 KiB) Viewed 886 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: BUG: inheritied class causes exception

Post by Support Team » Tue Jan 14, 2014 5:51 pm

Hi,

This is because you are trying to access a Instance in your own code which isn't there. To be precisely this
string _AppVer = TestSuite.Current.Parameters["AppVersion"];
is the line of code in your CommonFunctions.cs file which throws this error.

If you execute the recording only, this will always return "null" because you haven't an instance of the Test Suite. If you hit the play button on the Recording, Ranorex will be generate a complete new executable to just replay your steps inside your recording. When you replay the whole test suite this will work because the TestSuite instance will be there.

Regards,
Peter
Ranorex Team
.
Image

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: BUG: inheritied class causes exception

Post by odklizec » Tue Jan 14, 2014 6:34 pm

Mea culpa! Funny thing I did not notice this before? Thanks for your help Peter!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration