studio
2024.10
true
UiPath logo, featuring letters U and I in white
Studio User Guide
Last updated Nov 18, 2024

ST-REL-001 - Mismatched argument types

Rule ID: ST-REL-001

Scope: Coded workflow

Description

This rule ensures that the argument types of In/Out parameters are matching. For example, errors are highlighted when a DataTable is used as an output parameter for the Execute method, if the matching input parameter is a DataSet.
For instance, in the following code example, the same isConnected parameter is declared as bool, and then as an int. To resolve this, make sure the same type is used for the isConnected parameter both as input and output.
public (bool IsConnected, string Name) Execute(int IsConnected, int32 Name)
        {
            return (true, "Jade");
        }public (bool IsConnected, string Name) Execute(int IsConnected, int32 Name)
        {
            return (true, "Jade");
        }

Recommendation

We recommend to make sure that the data types for In/Out arguments always match. If the method returns a tuple, such as in public (bool IsConnected, string Name) Execute(int IsConnected, int32 Name), an In/Out argument must still be declared both before and after the method. In this case, IsConnected is the In/Out argument as it is declared twice.
On the other hand, when the method returns a single argument as in the example public int Execute(int Output, int c), you can declare an In/Out argument by naming it Output. Naming any argument as Output treats it as an In/Out argument, even if it's only declared once in the method.
  • Description
  • Recommendation

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.