System.ValueTuple error

Hello,
i am getting this error while creating a clickevent i have installed and system.valuetuple version properly but still its giving me this error can anyone help? @jpap @burque505 @Skip!

here is my code!

using Robin.Core;
using Robin.Core.Attributes;
using Robin.Core.Types;
using Robin.Modules.UIAutomation.Actions;
using Robin.Modules.UIAutomation.Actions.Enums;

using Robin.Shared.Runtime.Variants.ScalarVariants;
using System;
using System.Collections.Generic;
using System.ComponentModel;

using ActionException = Robin.Core.ActionException;

namespace Robin.Modules.CustomEvent
{
[Action(Name = “Click”, Order = 3)]
[Throws(“ClickFailedError”)]
public class ClickElementInWindow : UIAutomationActionBase
{
[DefaultValue(ClickType.LeftClick)]
[InputArgument(Order = 1)]
public ClickType ClickType
{
get;
set;
}

    [InputArgument(Name = "Element")]
    public override UIControl Control
    {
        get;
        set;
    }


    public ClickElementInWindow()
    {
    }

    internal static class ControlGuids
    {
        private readonly static Dictionary<string, Guid> Cache;

        static ControlGuids()
        {
            ControlGuids.Cache = new Dictionary<string, Guid>();
        }

        public static Guid GetGuid(string selector)
        {
            Guid guid;
            if (ControlGuids.Cache.TryGetValue(selector, out guid))
            {
                return guid;
            }
            Dictionary<string, Guid> cache = ControlGuids.Cache;
            Guid guid1 = Guid.NewGuid();
            Guid guid2 = guid1;
            cache[selector] = guid1;
            return guid2;
        }
    }

    public override void Execute(ActionContext context)
    {

        try
        {
            ValueTuple<string, string, int> valueTuple = UIAutomationActionBase.ParseSelector(this.Control);
            string item1 = valueTuple.Item1;
            string item2 = valueTuple.Item2;
            int item3 = valueTuple.Item3;
            
        }

        catch (ActionException actionException1)
        {
            ActionException actionException = actionException1;
            throw new ActionException("ClickFailedError", actionException.Message, actionException.InnerException);
        }
    }
}

}

1 Like

Hi, @abhi1100, I may well be wrong, as I am no C# expert by any stretch of the imagination, but it appears to me the problem may be in this code snippet:

public override UIControl Control
    {
        get;
        set;
    } 

‘UiControl’ is a type under Robin.Core.Types. ‘Control’ is an object of this type. You have an ‘override’ modifier here. According to this link

The override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.

It doesn’t appear to me that ‘Control’ in your code is an ‘inherited method, property, indexer, or event.’ Maybe try removing ‘override’?

On the other hand, though, the error message seems to indicate the compiler can’t find the referenced method, which according to dnSpy surely exists.

I sincerely hope this helps, and apologize in advance if it does not.

Regards,
burque505

1 Like

Hello ,@burque505
Thank You so much For your reply,
Control is actually inherited from UIAutomation modules
I am getting this new error.

The type ‘(T1, T2, T3)’ exists in both ‘System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ and ‘mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’

I think its version issue if you can help me to solve this than it will be really helpfull Thanks again in advance. @Skip @jpap

1 Like