Dictionary types not matching

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?

Thanks

new Dictionary(Of String, String) is this how you initialized

Hi,

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”.

img20200120-5

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?

Regards,

Yes

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?

Thanks

Hi,

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.

Regards,

Great thanks

1 Like

This is resolved