TaskSultan Docs tasksultan.com

Migrating from UiPath

Coded workflows

How a UiPath project whose entry point is a C# file is read, how the exception lane comes from the type and what the front end refuses.

A coded workflow is a UiPath project whose project.json points main at a C# file rather than a .xaml. The XAML front end cannot describe it and the Main.xaml beside it is an empty husk, so walking it would report an empty automation for a project that has one. The coded front end reads the C# instead and produces the same behaviour model the XAML path produces, so the codegen, its refusals and the transaction model apply unchanged.

#How the front end reads

The uipath ir and uipath codegen verbs choose a front end. With --front-end auto, the default, a coded project goes to the coded reader and everything else to the XAML walk. With --front-end xaml, a coded project is refused by name with CODED_FRONTEND_MISSING rather than answered with the husk's empty sequence.

The reader identifies the entry point by the method carrying the [Workflow] attribute. It is a bounded structural reader and not a C# compiler. Every construct it meets lands in exactly one of three places:

  • a modelled node, which is one of the node kinds the codegen already emits: sequence, try/catch, throw, rethrow, if, for-each-row, assign, variable or argument;
  • an attached surface, a construct consumed as part of another, such as a using scope or a class wrapper;
  • a named refusal, carrying the statement text as evidence.

Nothing is guessed and nothing is dropped. A private method of the class is never inlined. It is a separate conversion unit, the same boundary the XAML path draws for InvokeWorkflowFile and a private method with no call site is reported as dead code rather than translated.

#The model of a loop

The transaction model is per item, so the reader maps a row loop onto a for-each-row over a collection. A statement that reads the numeric row index is refused with CODED_ROW_INDEX_DROPPED, because that index does not exist in the emitted loop. A loop whose shape is not the collection row loop is refused with CODED_LOOP_SHAPE_NOT_MODELLED, rather than given a shape the source does not have.

#The lane is in the type

In XAML the catch body decides the exception lane, because almost every catch declares the undiscriminating base type. C# states the lane in the type. A catch (BusinessRuleException ex) is the business lane, never retried and the run continues. Every other exception type is the system lane: uncaught, it ends the method, so the run cannot continue and the bounded retry policy applies.

A narrow typed catch is marked so the codegen emits the exclusion: a bare catch (error) would catch everything, and a system failure inside the try must not be reported as an expected failure. A raised exception type that names neither lane takes the system lane and is recorded with CODED_LANE_UNATTRIBUTABLE, rather than inheriting a business lane from an enclosing catch.

#The refusals

The codes come in two sizes. Unit codes mean the coded project cannot be read at all, so the caller refuses the unit instead of falling back to the husk:

  • CODED_FRONTEND_MISSING, CODED_PROJECT_UNREADABLE, CODED_MAIN_NOT_CS, CODED_MAIN_MISSING, CODED_ENTRY_METHOD_MISSING, CODED_PARSE_REFUSED, CODED_SIGNATURE_REFUSED.

Node codes mean a construct inside the entry method has no modelled position, so it is carried inline as a TODO(conversion):

  • CODED_WORKBOOK_API_NOT_MODELLED, CODED_UI_ACTUATOR_NOT_MODELLED, CODED_LOCAL_METHOD_IS_A_SEPARATE_UNIT, CODED_LOG_CALL_NOT_MODELLED, CODED_CALL_UNRESOLVED, CODED_STATEMENT_NOT_MODELLED, CODED_CATCH_TYPE_UNNAMABLE, CODED_USING_SCOPE_NOT_MODELLED.

Unit-level findings are named and counted without being translated: CODED_DATATABLE_FIDELITY_NOT_MODELLED, CODED_METHOD_IS_ITS_OWN_CONVERSION_UNIT, CODED_DEAD_CODE_NOT_TRANSLATED, CODED_CLASS_FIELD_NOT_TRANSLATED, CODED_OR_DESCRIPTOR_NOT_RESOLVED and CODED_ARGUMENT_DEFAULT_NOT_CARRIED.

Note that CODED_WORKBOOK_API_NOT_MODELLED is a refusal of the reader, not a statement that the platform lacks Excel. ctx.excel exists and works. The reader simply models no Excel node, so the call is named rather than emitted into a facade this stage has not bound.

# read a coded project with the coded front end (the default)
npx tsx orchestrator/cli.ts uipath ir ./CodedProject

# insist on XAML: a coded project is refused by name
npx tsx orchestrator/cli.ts uipath ir ./CodedProject --front-end xaml

#Things that catch people out

  • main must be a .cs. A project with no main, or a main that is not C#, belongs to the XAML front end.
  • The reader reports a method inventory. A method other than the entry is its own conversion unit, so it is not translated inside this one.
  • The coded front end writes nothing. It reads files and returns values.