I have been using UiPath for a while but recently I have been having an issue with the data types when adding items to a dictionary. I try to add an item to a dictionary using the “Add to dictionary” activity, and I get the following error:
The data types in the dictionary definition and also the variable types in the variable window match (which are <String, String>).
So why is the “Add to dictionary” wanting an <Object, Object> type pair when I have defined the dictionary <Key, Value> pair as a <String, String>. The addition of a new <Key, Value> pair works when I use an “Assign” activity so why is it different for the “Add to dictionary” activity?
new Dictionary(Of String, String) is this how you initialized
When we put Add to Dictionary activity into the workflow, the following dialog will be shown.
And Your activity is probably set as “Object” and “Object”.
So, perhaps you should select appropriate type such as String in this case.
Can you try to re-put this activity and set these types?
Did this get resolved ? Is yes, pleases mark as resolved
Yes you are correct! This is strange though, if I drag the “Add to Dictionary” activity into the workflow from the Activities window then this dialog box comes up, however if I click the add activity “+” sign at the bottom of the workflow, search for “Add to Dictionary” and insert the activity that way then this dialog box does not appear (and hence I cannot select the String type).
Is there a reason for this or is it a bug?
I just reproduced your problem. “Microsoft.Activities.Extension Package” which includes Add to Dictionary activity is made by not UiPath by but Microsoft. So, it might be difficult for UiPath to handle this matter, although it may be a bug. I suppose perhaps you should use Assign Activity or Invoke Method Activity to do it for now.
Instead of adding the “Add to Dictionary” Activity using Add Activity(+) button.
Try to drag the “Add to Dictionary” Activity from Activities side bar this will allow you to select variable type.