An item with the same key has already been added. Key: VisualBasicValue`1_1 after windows conversion

After Windows Conversion from windows legacy. unable to run debug. “Run” and “Run file” works.

Full Error:
Main.xaml (235.2 KB)

22.10.1+Branch.master.Sha.6819bfe64fea81995a1624684fda5212d2bd4dc1

An item with the same key has already been added. Key: VisualBasicValue`1_1

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()

2 Likes

Hi @MKF_Motor_Sdn_Bhd

Can you share the error screenshot

Check out this thread

Regards
Gokul

Here you go, after clicking “Debug File”.

I have replaced all invalid " characters as i have faced this earlier in my othe projects after converting to windows.

Hi @MKF_Motor_Sdn_Bhd

You can try changing the targetFramework in the project json file.

Try launching the project and do some test runs to validate.

“targetFramework”: “Legacy”

image

Regards
Gokul

but … but … this defeats the purpose of performing a windows conversion? No?

Anyway after changing targetFramework : Legacy now it’s throwing this error:-

22.10.1+Branch.master.Sha.6819bfe64fea81995a1624684fda5212d2bd4dc1

Cannot set unknown member ‘{http://schemas.microsoft.com/netfx/2009/xaml/activities}VisualBasic.Settings’.

System.Xaml.XamlObjectWriterException: Cannot set unknown member ‘{http://schemas.microsoft.com/netfx/2009/xaml/activities}VisualBasic.Settings’. at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Xaml.XamlServices.Load(XamlReader xamlReader)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(XamlReader xamlReader, ActivityXamlServicesSettings settings)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(XmlReader xmlReader, ActivityXamlServicesSettings settings)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(Stream stream, ActivityXamlServicesSettings settings)
at UiPath.Executor.WorkflowLoader.LoadWorkflow(String xamlPath, String compiledWorkflowAssemblyName)
at UiPath.Executor.WorkflowRuntime.Load(String workflowFile)
at UiPath.Executor.RobotRunner.InitWorkflowApplication()
at UiPath.Executor.RobotRunner.d__99.MoveNext()

Plus i can’t re-open up my project after changing targetFramework to Legacy.

Hi everyone,

Do you have fixed this issue?
I found the same problem after Windows Converting.

Thank you in advance.

Leandro

Okay. i Found a weird thing that helped me.
If you are using the ReFramerwork, take a look at the State Machine Transitions conditions:

I replace they Is Nothing with the function IsNothing() and now its working:

I had to replace those after ‘Process Transaction’ as well:
image

I dont know why, but this seem to work. @loginerror, i guess you guys should take a look in that.

7 Likes

It now becomes the legacy framework from which we are trying to migrate from. Just changing it will not be helpful, isn’t it?

This is perfect. I am using RE Framework where the Nothing constant is being used all over the place and replacing them with Nothing as a method and not a constant, works.

This one worked for me too. I tried fixing this for a couple of months. I do now know how did you think about this, but I wish I found you earlier. Thank you!

1 Like

I also had the same issue with my modified ReFramework after converting to the new compatibility.
But then I checked out how a new project based on the official ReFramework looks with the Windows-compatibility and there they are still using the “TransactionItem IsNot Nothing” etc. conditions in the transitions.

So I simply re-wrote the conditions exactly how they were before and the errors disappeared as well.

Anyway, converting all of my processes from legacy to Windows seems to be not working as smooth as I’d hoped for.

2 Likes

Hi @lucas.stern

Interesting.

Do you happen to have a sample project that reproduces this issue from before the change?

I’m asking because it could be that simply clearing the field, saving, and then redoing what was there might fix the issue.

I tried to reproduce this, but creating a new Legacy ReFramework project on Studio 2022.12 and then converting it to a Windows project did not reproduce this issue.

Thank you Lucas, this saved me so much time.

@loginerror

Every project that we are converting has the problem presented and the solution Lucas showed works.

I want to confirm that in my case, simply cutting out (Ctrl-X) the full Condition statement with Nothing, and then pasting it back in will fix the issue as well. No need to rewrite using isNothing() method.
image

And this only needs to be done within the State Transitions in the Main.xaml file (a quick Ctrl+F for “Nothing” in the file identifies the points to change):
image

5 Likes

I have too the same error after Windows Conversion from windows legacy.
I fixed it just by modifying a condition “result=True” by “result= True” (add a space before the word True)
Ok it’s strange.

In fact, i noticed that xml code has changed with this modification :
Before :
<VisualBasicValue x:TypeArguments="x:Boolean" ExpressionText="result=True" sap2010:WorkflowViewState.IdRef="VisualBasicValue1_1" />`

After :
<VisualBasicValue x:TypeArguments="x:Boolean" ExpressionText="result= True" />

Attribute “sap2010:WorkflowViewState.IdRef” with value “VisualBasicValue`1_1” was already used in this xml file. By modifying element (add space by exemple) this attribute is removed

Had same issue, just copying and pasting didn’t do it because the file didn’t detect any changes, added spaces to all conditions in the transition states in main, saved it that way, and now it works :man_facepalming:

1 Like

Just adding my cents to the pile, Lucas’s fix also worked for the same error on a project we converted.

Thanks for confirming @Noppy

I will actually mark your answer as as solution, even though there were several provided in the topic (but yours confirms my assumption).

I believe this is already considered from the Studio side as well, and the migration tool will hopefully take it into account on newer versions :slight_smile: