Random errors in Ranorex generated cs files

Ask general questions here.
costamesakid
Posts: 94
Joined: Tue Jun 16, 2009 10:27 pm

Random errors in Ranorex generated cs files

Post by costamesakid » Mon Oct 24, 2011 10:19 pm

I decided to try out the Ranorex Recorder for the first time in a while instead of coding all my validation statements by hand because the recorder has always failed me in the past. This time I just wanted to validate some text and continue on fail. I recorded the validation item and got the following errors in my Ranorex generated cs file:
'TacViewLib.UISpecific.Preferences.General_Preferences.DefaultSettings.Validate' does not contain a definition for 'DefaultMessage' (CS0117) - C:\TacView\TacViewLib\UISpecific\Preferences\General_Preferences\DefaultSettings\Reset.cs:94,267
'TacViewLib.UISpecific.Preferences.General_Preferences.DefaultSettings.Validate' does not contain a definition for 'Attribute' (CS0117) - C:\TacView\TacViewLib\UISpecific\Preferences\General_Preferences\DefaultSettings\Reset.cs:94,26
I have these methods in 1000's of other user code files and the solution builds without incident until I used the recorder to validate an item. Any idea what is wrong with the Ranorex generated code? Thanks

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// This file was automatically generated by RANOREX.
// DO NOT MODIFY THIS FILE! It is regenerated by the designer.
// All your modifications will be lost!
// http://www.ranorex.com
//
///////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;

namespace TacViewLib.UISpecific.Preferences.General_Preferences.DefaultSettings
{
    /// <summary>
    /// The Reset recording.
    /// </summary>
    [TestModule("75a4e3bb-6e50-44f5-8aae-c8a6867f2e9c", ModuleType.Recording, 1)]
    public partial class Reset : ITestModule
    {
        /// <summary>
        /// Holds an instance of the TacViewLib.TacViewLibRepository repository.
        /// </summary>
        public static TacViewLib.TacViewLibRepository repo = TacViewLib.TacViewLibRepository.Instance;

        static Reset instance = new Reset();

        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        public Reset()
        {
        }

        /// <summary>
        /// Gets a static instance of this recording.
        /// </summary>
        public static Reset Instance
        {
            get { return instance; }
        }

#region Variables

#endregion

        /// <summary>
        /// Starts the replay of the static recording <see cref="Instance"/>.
        /// </summary>
        [System.CodeDom.Compiler.GeneratedCode("Ranorex", "3.1.1")]
        public static void Start()
        {
            TestModuleRunner.Run(Instance);
        }

        /// <summary>
        /// Performs the playback of actions in this recording.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        [System.CodeDom.Compiler.GeneratedCode("Ranorex", "3.1.1")]
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.0;

            Init();

            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'FormTacViewC2.MenuItemFile' at Center.", repo.FormTacViewC2.MenuItemFileInfo, new RecordItemIndex(0));
            repo.FormTacViewC2.MenuItemFile.Click(250);
            Delay.Milliseconds(0);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'File_Menu.Preferences' at Center.", repo.File_Menu.PreferencesInfo, new RecordItemIndex(1));
            repo.File_Menu.Preferences.Click(250);
            Delay.Milliseconds(0);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'Preferences_Control.ButtonReset' at Center.", repo.Preferences_Control.ButtonResetInfo, new RecordItemIndex(2));
            repo.Preferences_Control.ButtonReset.Click(250);
            Delay.Milliseconds(0);
            
            try {
                Report.Log(ReportLevel.Info, "Validation", "(Optional Action)\r\nValidating AttributeEqual (Text='This will restore TacViewC2 to its original settings.\nYou must restart the application for these changes to take effect.\n\nWould you like to continue?') on item 'FormRealView_Error.TextThis_will_restore_TacVie'.", repo.FormRealView_Error.TextThis_will_restore_TacVieInfo, new RecordItemIndex(3));
                Validate.Attribute(repo.FormRealView_Error.TextThis_will_restore_TacVieInfo, "Text", "This will restore TacViewC2 to its original settings.\nYou must restart the application for these changes to take effect.\n\nWould you like to continue?", Validate.DefaultMessage, false);
                Delay.Milliseconds(0);
            } catch(Exception ex) { Report.Warn("(Optional Action) " + ex.Message); }
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'RealViewDialog.ButtonYes' at Center.", repo.RealViewDialog.ButtonYesInfo, new RecordItemIndex(4));
            repo.RealViewDialog.ButtonYes.Click(250);
            Delay.Milliseconds(0);
            
        }

#region Image Feature Data
#endregion
    }
}

costamesakid
Posts: 94
Joined: Tue Jun 16, 2009 10:27 pm

Re: Random errors in Ranorex generated cs files

Post by costamesakid » Mon Oct 24, 2011 10:41 pm

Well apparently Ranorex didnt like my 2 recording modules named 'Reset' and 'Validate'. I updated them to 'ResetSettings' and 'ValidatedSettings' then my solution built

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

Re: Random errors in Ranorex generated cs files

Post by Support Team » Tue Oct 25, 2011 9:09 am

Hi,

If you use Validate for a Recording you create a class named Validate and this class conflicts with the Validate Method of Ranorex. There are few values you shouldn't use and in a future release of Ranorex we will have a "Black List" with values you can't use.

Regards,
Peter
Ranorex Team
.
Image