Possible bug

I have just recently upgraded to the latest version of UI Path Studio (Version 2023.4.3) and started a new project and tried to update the UiPath.UIAutomation.Activities to the latest version.


After updating, I got an error “Collection was modified; enumeration operation may not execute”.

Error: RemoteException wrapping System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.HashSet1.Enumerator.MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext()
at System.Linq.Enumerable.DistinctIterator1.MoveNext() at System.Collections.Generic.HashSet1.UnionWith(IEnumerable1 other) at System.Collections.Generic.HashSet1…ctor(IEnumerable1 collection, IEqualityComparer1 comparer)
at System.Linq.Enumerable.ToHashSet[TSource](IEnumerable1 source, IEqualityComparer1 comparer)
at System.Linq.Enumerable.ToHashSet[TSource](IEnumerable1 source) at UiPath.Studio.Plugin.Workflow.Services.ProjectAssemblyContainer.FilterAssistantAssemblies(String[] paths, String projectDirectory) at UiPath.Studio.Plugin.Workflow.Services.ProjectAssemblyContainer.LoadAssemblies(String[] paths, String projectDirectory, TargetFramework targetFramework) at UiPath.Studio.Plugin.Workflow.Configuration.ProjectProcessServiceHost.LoadAssemblies(String[] paths, String projectDirectory, TargetFramework targetFramework) at UiPath.Studio.Project.Services.ProjectIpcService.ExecuteStageOneOpen(ProjectProcessOpenStageOneArgs args) at UiPath.CoreIpc.Server.<>c__DisplayClass7_3.<<-ctor>g__InvokeMethod|6>d.MoveNext() --- End of stack trace from previous location --- at UiPath.CoreIpc.Server.<>c__DisplayClass7_1.<<-ctor>g__HandleRequest|3>d.MoveNext() --- End of stack trace from previous location --- at UiPath.CoreIpc.Server.<>c__DisplayClass7_2.<<-ctor>b__5>d.MoveNext() --- End of stack trace from previous location --- at UiPath.CoreIpc.Helpers.Timeout[TResult](TimeSpan timeout, List1 cancellationTokens, Func2 func, String message, Func2 exceptionHandler), HResult -2146233088

I also have the same type of bug when I tried to open my projects created with the older version of UI Path studio, something I never experienced when I have upgraded from a much older version to the 2022 one.

Hey @redanime94 ,

Just wanted to check if that’s occurring on a new project or if there were other activities already added to the designer or any other packages installed.

Many thanks,

Hey @redanime94 ,

If you try to modify the collection list during enumeration, it raises an exception. So the issue behind this error is, we can not modify the list/dictionary while we are looping through the same.

Hey @redanime94 ,

I tried to follow the steps you described:

  • installed Studio 23.4.3
  • updated UIAutomation package from v23.4.7 to v23.4.8
  • declared a String array System.String[ ] and then modified the elements of the list
  • declared a Dictionary<Int32, String> which I initialized with some values, then in a For Each activity I modified the values

All these steps worked without errors. Attached is my test project.
BlankProcess10.zip (143.7 KB)

Please let us know the type of the collection you tried to modify. If you can send us a sample code, that would be helpful.


Hi @redanime94 ,

Would you be able to share with us a sample process to try and investigate this further?


Hi all,

The issue seemed to have been resolved. However, I noticed that the UiPath.System.Activities have been updated which could have just resolved the issue.

Thanks to all your responses btw.