Collection was modified enumeration operation might not execute

Hi,

When opening a robot i get the message “collection was modified enumeration operation might not execute” regullarly. After 3 times or more the robot opens. How can I prefend this from happening?

21.4.3+Branch.master.Sha.7d66317b828533c43b8fc299ec1cfdc22a138bc2

Collection was modified; enumeration operation may not execute.

Open Document Error: UiPath.Studio.Contracts.RecoverableException
—> UiPath.Studio.Contracts.RecoverableException: The item ‘L:\Smallsteps Staf\RPA\Programma\Kocon-Facturatie - Kocon33 uitzonderingen Fysiek sturen\Main.xaml’ could not be opened: An exception was thrown while activating UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerWrapper…
—> RemoteException wrapping Autofac.Core.DependencyResolutionException: An exception was thrown while activating UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerWrapper. —> RemoteException wrapping Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(UiPath.Studio.Plugin.Workflow.WorkflowHandling.IDesignerBuilder, UiPath.Studio.Contracts.Desktop.MVVM.IDispatcherService, UiPath.Studio.Plugin.Workflow.ExpressionEditor.IExpressionEditorRepository, System.Func1[UiPath.Studio.Plugin.Workflow.FindReferences.IFindReferencesManager], UiPath.Studio.Plugin.Workflow.Services.Interfaces.IDocumentationLinksService, UiPath.Studio.Contracts.Desktop.IResourceIconsService, UiPath.Studio.Analytics.Contracts.ITelemetryProvider, UiPath.Studio.Contracts.IOutputLoggerService, UiPath.Studio.Plugin.Workflow.Services.Interfaces.IInvokeWorkflowProjectService, UiPath.Studio.Plugin.Workflow.Services.Interfaces.IRefactoringsService, UiPath.Studio.Plugin.Workflow.Shared.Activities.IActivityFactory, UiPath.Studio.Plugin.Workflow.Services.Interfaces.ISimpleMessageBoxService, System.IO.Abstractions.IFileSystem, UiPath.Studio.Plugin.Workflow.WorkflowHandling.Theme.IDesignerThemeBehavior, UiPath.Studio.App.Desktop.MVVM.Commands.ICommandFactory, UiPath.Studio.Plugin.Workflow.WorkflowHandling.IDesignerConfiguration, System.Func2[System.Activities.Presentation.WorkflowDesigner,UiPath.Studio.Plugin.Workflow.WorkflowHandling.Variables.IAdvancedDocumentVariablesService], UiPath.Studio.Plugin.Workflow.Debugger.Execution.Services.IDesignerExecutionService, Factory, Factory, UiPath.Studio.Contracts.Profile.IProfile, UiPath.Studio.Activities.Api.IWorkflowDesignApi, UiPath.Studio.Plugin.Workflow.Shared.Services.Interfaces.ISettingsServiceWrapper, UiPath.Studio.Plugin.Workflow.Debugger.Navigation.Services.IDesignerExecutionTrailService, UiPath.Studio.Plugin.Workflow.Execution.Services.IExecutionTrailRepository, Factory, UiPath.Studio.Plugin.Workflow.WorkflowHandling.Interfaces.IInsertActivityService, UiPath.Studio.Plugin.Workflow.WorkflowHandling.Interfaces.IInsertWizardResultService, UiPath.Studio.Plugin.Workflow.Shared.Interfaces.IExpressionCompiler, System.Func3[System.Windows.FrameworkElement,UiPath.Studio.Plugin.Workflow.WorkflowHandling.IDesignerOwner,UiPath.Studio.Plugin.Workflow.WorkflowHandling.PropertyGridWrapper], Factory, UiPath.Studio.Plugin.Workflow.Shared.WorkflowHandling.IDesignerActivitiesCommandsRepository, UiPath.Studio.Plugin.Workflow.SyntaxLanguage.ISyntaxLanguageService, UiPath.Studio.Plugin.Workflow.AddInFramework.IAddInProjectService, UiPath.Studio.Plugin.Workflow.Shared.Excel.IExcelService, UiPath.Studio.Plugin.Workflow.Shared.ToolWindows.IToolWindowProjectService, UiPath.Studio.Plugin.Workflow.WorkflowHandling.Interfaces.IDesignerDecoratorService, UiPath.Studio.Plugin.Workflow.Shared.Services.Interfaces.IDesignerViewAdornerService, UiPath.Studio.Plugin.Workflow.Patches.Interfaces.IPatchService, UiPath.Studio.Plugin.Workflow.Services.Interfaces.IActivityIconFinder)' on type 'DesignerWrapper'. ---> RemoteException wrapping System.TypeInitializationException: The type initializer for 'System.Activities.Presentation.WorkflowDesigner' threw an exception. ---> RemoteException wrapping System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.KeyCollection.Enumerator.MoveNext()
at System.Activities.Presentation.Metadata.MetadataStore.MetadataStoreProvider.AddTable(AttributeTable table, Boolean isSystemAttributeTable)
at System.Activities.Presentation.Metadata.MetadataStore.AddAttributeTableCore(AttributeTable table, Boolean isSystemAttributeTable)
at System.Activities.Presentation.Metadata.MetadataStore.AddAttributeTable(AttributeTable table)
at System.Activities.Presentation.DesignerMetadata.Register()
at System.Activities.Presentation.WorkflowDesigner…cctor()
— End of inner exception stack trace —
at System.Activities.Presentation.WorkflowDesigner…ctor()
at UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerBuilder.BuildBasic()
at UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerBuilder.BuildInternal(DesignerEventsSubscriber eventsSubscriber, String workflowId, String fileName)
at UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerBuilder.Build(DesignerEventsSubscriber eventsSubscriber, String workflowId, String fileName)
at UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerWrapper…ctor(IDesignerBuilder designerBuilder, IDispatcherService dispatchingService, IExpressionEditorRepository expressionEditorService, Func1 findReferencesManagerFactory, IDocumentationLinksService documentationLinksService, IResourceIconsService resourceIconsService, ITelemetryProvider telemetryProvider, IOutputLoggerService outputLoggerServices, IInvokeWorkflowProjectService invokeWorkflowSupport, IRefactoringsService refactoringsService, IActivityFactory activityFactory, ISimpleMessageBoxService simpleMessageBoxService, IFileSystem fileSystem, IDesignerThemeBehavior designerThemeBehavior, ICommandFactory commandFactory, IDesignerConfiguration designerConfiguration, Func2 designerVariablesServiceFactory, IDesignerExecutionService executionController, Factory workflowTransformRepositoryFactory, Factory expressionEditorServiceFactory, IProfile profile, IWorkflowDesignApi workflowDesignApi, ISettingsServiceWrapper settingsServiceWrapper, IDesignerExecutionTrailService designerExecutionTrailService, IExecutionTrailRepository executionTrailRepository, Factory contextMenuBuilderFactory, IInsertActivityService insertActivityService, IInsertWizardResultService insertWizardResultService, IExpressionCompiler expressionCompiler, Func3 propertyGridWrapperFactory, Factory workflowDesignerValidationServiceFactory, IDesignerActivitiesCommandsRepository designerActivitiesCommandsRepository, ISyntaxLanguageService syntaxLanguageService, IAddInProjectService addInService, IExcelService excelService, IToolWindowProjectService toolWindowProjectService, IDesignerDecoratorService designerDecoratorService, IDesignerViewAdornerService designerViewAdornerService, IPatchService patchService, IActivityIconFinder activityIconFinder) at lambda_method(Closure , Object[] ) at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate() --- End of inner exception stack trace --- at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters)
at Autofac.Core.Activators.Reflection.ReflectionActivator.b__11_0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.ScopeSelectionMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at lambda_method(Closure )
at UiPath.Studio.Plugin.Workflow.Services.DesignerRepository.<>c__DisplayClass10_0.b__0()
at UiPath.Studio.Shared.MVVM.Services.DispatcherExtensions.Invoke(Dispatcher dispatcher, Action action, Boolean onlyBeginInvokeWhenNoAccess)
at UiPath.Studio.Shared.MVVM.Services.DispatcherService.Invoke(Action action, Boolean onlyInvokeWhenNoAccess)
at UiPath.Studio.Plugin.Workflow.Services.DesignerRepository.AddDesignerWrapper()
at UiPath.Studio.Plugin.Workflow.Services.DesignerFileProjectEndpoint.<>c__DisplayClass5_0.<b__0>d.MoveNext()
— End of stack trace from previous location where exception was thrown —
at UiPath.Studio.Plugin.Workflow.Services.DesignerFileProjectEndpoint.<>c__DisplayClass5_0.<b__0>d.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shared.MVVM.Services.DispatcherService.d__15.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Plugin.Workflow.Services.DesignerFileProjectEndpoint.d__5.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.CoreIpc.Server.d__22.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.CoreIpc.Server.d__21.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.CoreIpc.Server.<>c__DisplayClass4_2.<<-ctor>b__6>d.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.CoreIpc.IOHelpers.d__13.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.CoreIpc.IOHelpers.d__191.MoveNext() --- End of inner exception stack trace --- at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) at UiPath.Studio.Shell.Services.DocumentService.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options)
at UiPath.Studio.Core.Services.PersistableServiceBase`3.OpenAsync(OpenInformation openInfo)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenDocumentAsync(OpenInformation openInfo)
— End of inner exception stack trace —
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenDocumentAsync(OpenInformation openInfo)
at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenPath(String filePath)
at UiPath.Studio.Shell.ShellApplication.StudioShellApplication.ProcessWithCommandLine()
at UiPath.Studio.Shell.ShellApplication.StudioShellApplication.<>c__DisplayClass19_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at System.Threading.Tasks.Task.<>c.b__140_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

Nobody??? Not even UiPath staff??

We are encountering the same problem since updating Studio to 21.4.3. Upgrading to Version 21.4.4 didn’t help.

Something definitely changed from Version prior 21.4.

1 Like

“glad” to see that I am not the only one. Let’s hope someone with a solution visits this topic.

Hi,

The following topic says it solved by updating to the latest UiPath.System.Activities package.
Can you try this?

Regards,

Usually I have the latest version but I’ll keep an eye on it.

I updated all the packages after posting here. But indeed this seems to resolve the problem for now. Let’s see if the problem reoccurs.

Did not work. I think UiPath should resolve this and not have a work around. Besides, it is very frustrating if you have to open a xaml 6 times before you can even update.

Yes, problem reoccured for us as well. I am going to write technichal support for assistance.

1 Like

Can you share when you have a reaction?

Yes, I will share the outcome. May take some time.

Do you have a For Each loop that’s trying to update the properties of the thing you’re looping through? That’s what this error means. For example.

For each plate in dinner.list
- assign plate = “some text”
//for each

You can’t do this because you’re looping through the same list you’re trying to edit.

That is not it. We cannot even open te xaml.

Understood. Have you tried uninstalling and reinstalling Studio?

I think that should be a last resort. It happens on al 7 virtual machines.

I wonder if you have a firewall/proxy that is blocking access to the online package repositories.

We had no issue the last 4 years. It is after the update that this happens.

Step1 : Note down the installed version
Step2 : Remove installed version UiPath.System.Activities and save
Step3 : installed the UiPath.System.Activities version you noted down and save

try to open the main.xaml file

:grinning: