Editing the xaml files to add DisplayName

Hi,

While it is difficult to change all the default names of the activities, in a big project, it comes handy when having errors. The code below will give the error : “Assign: Value was either too large or too small for an Int32.”, but you do not know immediately which Assign it was.
What I would need is to parse the xaml and add the property DisplayName with the same value as WorkflowViewState.IdRef if it’s missing. In this way the activities I have named keep their name and the ones that I did not name will get a unique name which will improve the logging.
Did anyone do such editing? Or have an idea of how to do it quickly and easily?

<Assign sap:VirtualizedContainerService.HintSize="262,60" sap2010:WorkflowViewState.IdRef="Assign_1">
  <Assign.To>
    <OutArgument x:TypeArguments="x:Int32">[i]</OutArgument>
  </Assign.To>
  <Assign.Value>
    <InArgument x:TypeArguments="x:Int32">[10-10]</InArgument>
  </Assign.Value>
</Assign>
<Assign sap:VirtualizedContainerService.HintSize="262,60" sap2010:WorkflowViewState.IdRef="Assign_2">
  <Assign.To>
    <OutArgument x:TypeArguments="x:Int32">[j]</OutArgument>
  </Assign.To>
  <Assign.Value>
    <InArgument x:TypeArguments="x:Int32">[Cint(6/i)]</InArgument>
  </Assign.Value>
</Assign>

You need to write a script of some sort to do this. The xaml files are simply xml files. Read the file in as xml, find all assigns and check if it has a DisplayName property, if it does, move to next assign. If not, add the property and set equal to IdRef.

You could do this with a UiPath automation, or with Powershell. I’m sure there are other approaches too.

As always, make sure you backup your file first. UiPath gets cranky quickly if the format of the xaml doesn’t meet expectations.