Issue creating Background process using template

I am getting the below issue while creating a background process using the template:
An item with the same key has already been added. Key: Microsoft.Win32.Primitives
21.4.4+Branch.master.Sha.a8b5101efe02651274064093e9c7410fedff7696

The project ‘C:\Users\name\Documents\UiPath\TestGIG\project.json’ could not be opened: An item with the same key has already been added. Key: Microsoft.Win32.Primitives.

Cannot open item: UiPath.Studio.Contracts.RecoverableException: The project ‘C:\Users\name\Documents\UiPath\TestGIG\project.json’ could not be opened: An item with the same key has already been added. Key: Microsoft.Win32.Primitives.
—> System.ArgumentException: An item with the same key has already been added. Key: Microsoft.Win32.Primitives
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable1 source, Func2 keySelector, IEqualityComparer1 comparer)
at UiPath.PackageExplorer.Core.Services.PackageInstaller.GetAssembliesByRootPackage(InstallPackageCommand installCommand, RestoreResult result)
at UiPath.PackageExplorer.Core.Services.PackageInstaller.InstallWithRootPackageAssemblies(InstallPackageCommand installCommand)
at UiPath.Studio.Core.Services.Packaging.PackageOperationBase.RestoreInternal(PackageOperationContext packageOperation, CancellationToken cancellationToken)
at UiPath.Studio.Core.Services.Packaging.PackageOperationBase.<>c__DisplayClass23_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at UiPath.Studio.Core.Services.Packaging.PackageOperationRestore.Execute(CancellationToken cancellationToken)
at UiPath.Studio.Core.Services.Packaging.PackageService.RestoreProjectAsync(IProject project, CancellationToken cancellationToken)
at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.InitializeNewProjectModelInternal(String projectFilePath)
at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsyncInternal(String path, IOpenOptions options)
at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsync(String path, IOpenOptions options)
at UiPath.Studio.Plugin.Workflow.Shared.Project.BaseWorkflowProjectFactory.OpenAsync(String path, IOpenOptions options)
at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options)
— End of inner exception stack trace —
at UiPath.Studio.Core.Services.PersistableServiceBase3.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options)
at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options) at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OnOpenAsync(String path, IFactory2 resolvedFactory, IOpenOptions options)
at UiPath.Studio.Core.Services.PersistableServiceBase3.OpenAsync(OpenInformation openInfo) at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenProjectAsync(OpenInformation openInfo, IProject newProject) at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenNewProjectAsync(IProject newProjectItem) at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.CreateNewProjectAsync(IProjectTemplate template) at UiPath.Studio.Shell.Templates.ViewModels.TemplateDetailsViewModel.UseTemplateCommandExecute() at UiPath.Studio.App.Desktop.MVVM.Commands.TaskCommand3.Execute(TExecuteParameter parameter, Boolean ignoreCanExecuteCheck)
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

Any resolution is appreciated.

Thanks

@geetishree.rao

It seems like there is some bug with Background process template in 21.4 version. Please follow the steps mentioned in the below thread to resolve the issue.

Thanks Lakshman…I too came across this…So created the process from anormal proc and with the background settings

@geetishree.rao

Great.
If the issue got resolved, please close the thread by marking it as solution. So that it will help others who are facing similar solution. Thank you.

The Studio 2021.4 stable version has this bug while using background process template. So to create a background process.Please follow the below steps:
1.Create a normal process
2.Add WebAPI package dependency
3.Remove the UIAutomation pkg if you are not invoking a foreground proc from it
4.Set the project Setting to Start as Background

Hope this helps to others facing the same issue.

Thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.