Log Message Error: 'Collection was modified; enumeration operation may not execute.'

I have a process that has been running fine but one time has given an error message ‘Collection was modified; enumeration operation may not execute.’.
It occurred at the “Killing processes…” log message in the KillAllProcesses.xaml part of the framework.
My understanding of that error message is that it normally triggers when you modify data from within an activity looping through items which that data is part of.
I don’t understand why a log message would throw this error because it shouldn’t be modifying data.
I haven’t even passed any arguments to KillAllProcesses.xaml.
Does anyone have any ideas as to why this error has occurred?

1 Like

Are you trying to delete any rows under the loop?

Have a look at this,

Thanks,
Rammohan B.

Well,

This is a peculiar once coz I have never come across such scenario. Can you please check again whether it is the ‘Log Message’ activity throwing the error, and make sure you don’t have any variable logging (if so then make sure you don’t have methods or functions manipulating the said variable)

If none of the above scenarios are true then can you tell me the version (Enterprise/Community) name and version num. ?

Regards :slight_smile:

Hi, it is definitely the Log message activity that threw the error, see log extracts below. I have also attached an image of the activity in UiPath and there is no variable involved in the log. The robot is running Enterprise version 18.4.3.

06:01:13.7667 Trace {“message”:“Log message - Killing Processes. (KillAllProcesses) Executing”,“level”:“Verbose”,“logType”:“Default”
06:01:13.7667 Trace {“message”:“Log message - Killing Processes. (KillAllProcesses) Faulted”,“level”:“Verbose”,“logType”:“Default”
06:01:13.7667 Error {“message”:“Log message - Killing Processes. (KillAllProcesses): Collection was modified; enumeration operation may not execute.”,“level”:“Error”,“logType”:“Default”

image

Well

I am just putting it out there, if there is no variable and if you haven’t marked it as ‘private’ in properties channel I don’t think such an error should occur in logging messages for all.

Try deleting and creating the same log message and please get back. Build that part again outside the scope of killing processes, and beyond that container log the message.

Hope this works :slight_smile: