InvokeWorkflowFile does not enforce return type to match while enforcing input type to match


When invoking a workflow file and passing a wrong argument type IN, it will throw error.
When invoking a workflow file and storing return (OUT) argument in a wrong variable type, it will convert the value (even if no implicit conversion exists).
This leads to uncontrolled value changes between workflows and hiding design errors (non-compatible types paired).

Didn’t test all types, but after short investigation I’d expect it to also “treat as the same”:
anything representing numbers
anything that is serializable to a number (enums, bools)
anything that serializes to the same structure (tested after uploading - SortedList(Of Integer, Double) and Dictionary(Of String, Integer) are interchangeable…)

Steps to reproduce:

  1. Download attached project.
  2. Run Main.xaml.
  3. Observe that:
  • A Double is stored as a String (using default culture)
  • A Double is stored as an Int (losing decimal precision)
  • A String is stored as a Double (implicitly parsing)

Current Behavior:

Judging by the error messages when you really go wild with type mismatches, it seems to be using Json serialization when types don’t match (can’t say if also uses it if it matches).

Expected Behavior:

Throws error, same as when IN argument doesn’t match.

Studio/Robot/Orchestrator Version:

Last stable behavior: N/A
Last stable version: N/A (don’t know)
OS Version: Win 10

Others if Relevant: (workflow, logs, .net version, service pack, etc): (14.2 KB)

Tested in 2018.1 and 2018.4, both give unexpected behaviour.

Proposed solution

Make it throw an exception of mismatched arguments, same as with IN arguments.

Hi @andrzej.kniola

Update on the isssue. UiPath.System.Activities 20.10.1 should fix the issue.
The activity will now produce validation errors when types mismatch.