Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

UiPath Pitfall #4: A Variable With the Same Name as Your Argument

Описание и применение

Проблема: аргумент Out становится Nothing после блока Do из‑за переменной с тем же именем. Решение – удалить дублирующую переменную, использовать анализатор потоков и префиксы для аргументов.

Задача

An Out argument receives a value, but after exiting a Do block it becomes Nothing because a variable with the same name shadows the argument.

Результат

The Out argument retains its value after the Do block once the duplicate variable is removed and the workflow is analyzed.

Рабочий процесс

  • Identify that an Out argument is unexpectedly Nothing after a Do block.
  • Check the Variables panel for a variable named the same as the argument within the Do block.
  • Delete the duplicate variable and keep the argument.
  • Re-select the argument in the Assign activity.
  • Run Workflow Analyzer to catch Variable Overrides Argument (ST‑NMG‑006).
  • Set ST‑NMG‑006 to Error to surface the issue immediately.
  • Use direction prefixes (in_, out_, io_) only for arguments to avoid confusion.
  • Assign the Out argument once at the end of the workflow, using a local variable for intermediate calculations.

Доказательства

Most of the time, a variable and an argument share a name.

Источник

If a variable and an argument have the same name, the variable is always the one used at runtime.

Источник

Ctrl + K in the To field of an Assign creates a new variable, not an argument.

Источник

Run Analyze File or Analyze Project from the Design ribbon. There are rules for exactly this: ST‑NMG‑006 Variable Overrides Argument.

Источник

  • Дата записи: 2026-11-01T02:44:02.781Z