Unable to run Framework project, System.Argument exception for apparent duplicate dictionary key

Hi all

I’ve encountered another problem following upgrade Studio 22.10.3, update of activity packages and migration of project from Windows Legacy to Windows.

On running the project under debug, starting with Main, even before a single workflow activity has started (i.e. when use Step Into or with breakpoint on the very first breakpoint possible, the TryCatch in the Initialization state of the framework), the following exception is thrown:

System.ArgumentException: An item with the same key has already been added. Key: VisualBasicValue1_1 at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)
at UiPath.Executor.Tracking.ActivityIdsResolver.Register(WorkflowInfo workflowInfo)
at UiPath.Executor.Tracking.DebugTrackingParticipant.RegisterWorkflow(WorkflowInfo workflowInfo)
at UiPath.Executor.DebuggerPlugin.UiPath.Executor.IDebuggerPlugin.RegisterWorkflowTracking(WorkflowInfo workflowInfo)
at UiPath.Executor.Tracking.WorkflowTracking.RegisterWorkflowTracking(WorkflowInfo workflowInfo)
at UiPath.Executor.WorkflowRuntime.RegisterWorkflow(WorkflowInfo workflowInfo)
at UiPath.Executor.RobotRunner.InitWorkflowApplication()
at UiPath.Executor.RobotRunner.ExecuteJob()

There is no mention of any specific activity in the exception, no activity is navigated to and highlighted automatically, as is normal with run-time errors.

I am not aware of any change to .Net that prevents an assign statement that would update a value of an existing key, that if the key doesn’t exists would instead create the new key.

I’ve no explanation of this behavior which is entirely unexpected and urgently need a solution.

UiPath support, please advise if I need to formally raise a case to you via vendor.

Hi,

In this case, it’s necessary to modify duplicated key in the xaml file directly using text editor.
There are 2 or more VisualBasicValue1_1 in the xaml, then modify one of them to VisualBasicValue1_2 , for example.

Please see the following post in details.

Regards,

2 Likes

Hi @stevewakley

There might be two variables with same name in your sequence. You are not seeing any highlight may be because in the new upgrade the first or the outer sequence is hidden . SO when the execution is on outer sequence you wont see a highlight

Try checking the variables panel and arguments panel in that xaml

May be same name is given in argument and variable as well

cheers

Hi Yolci

Perfect, thanks very much. There were about 3 duplicates, 7 instances in total so amended all to be in sequence 1_1, 1_2, etc. This appears to have resolved the problem.

@UiPath (can we tag UiPath support here?) please can you amend your FAQs to include this fix (not ideal, as always reluctant to hack the .xaml files in this way) while you amend the project conversion function for the next release.

2 Likes

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