Merely changing the name of variable will trigger error in For Each activity

“Error ERROR Validation Error The activity delegate with Handler ‘Body’ cannot be referenced by activity ‘For Each’ because the latter is not in the implementation of activity ‘DynamicActivity’. An activity delegate can only be referenced by the implementation of an activity which specifies that activity delegate as a child or import. The activity delegate with Handler ‘Body’ is declared by activity ‘For Each’. Workflows/PrepararCarpetesPerATeams.xaml”

This is the error I got in a couple ForEach activities after I merely changed the name of a variable involved in it.

The variable name is that one of the collection I’m passing to the loop. Workflows are involved, so the collection gets there via a previous couple of in/out arguments.

After hours of scratching my head, I merely replicated the ForEach activity in the same place, then those errors disappeared. But I noticed:

a) The prior “wrong” activity can’t be erased at all.
b) The “wrong” activity got duplicated, with the new, repliced ForEach loop being placed in the middle of the loop.

The second, duplicated one after the good, “replicated” one, could be erased.

The previous and original one, I could delete part of the innter contents of the activity little by little, but, in the end, it stays inside the surrounding “Sequence” activity but, weirdly, is not attached / connected to any prior or next activity: it’s “unnatached”, not linked to anything, and it can’t get erased.

Amazing bug and amazing the mess I got by merely renaming a var, something I believe is so trivial that should be accomplish automatically for every instance of the variable or every place it’s being used across the “code”. And if it’s not going to be that way, then at least provide a way to refactor a variable, or if not even possible, at least don’t screw up the whole code when attempting a variable rename.

Attaching a screenshot of the “orphan”, unlinked activity.

Yeah, this si happening since they decided to put this “automatic” for each in Studio. I have met this bug ith it so many times, that I wonder if enough people use this tool, because its fun how this is still happening. My suggestion to you? If this happen, redo the sequence :slight_smile:

My suggestion to UiPath? Please, let us use the old for each, where we must set th correct variable type by ourselfs instead of this one.

They announced they plan to bring the manual selection back, as I understand it (or hope) you should be able to toggle the auto data typing on or off.

1 Like