Invoke Method Add Error

Am adding to a dictionary using Invoke Method and methodName=Add. I keep getting an error (shown in the screenshot below):

This is from “RPA Developer - Production Ready Essentials”, part 3 - Data Manipulation, lesson 8 - Practice 3 - Dictionaries & Integers

Am trying to replicate the solution given in this lesson (at the bottom of the lesson). Funny thing is when I open the solution given in this lesson - “Practice 3 - Dictionaries (Workflow).zip” and run it in UiPath Studio, there is no “Invoke Method Add” error. I wonder why that is.

How do I get rid of this error?


@kewakerukeli What is the type of dictionary_NumberO ?

@supermanPunch, dictionary_NumberOfTimesWon is a variable of type Dictionary<String,Int32>

@kewakerukeli What parameters have you passed to Invoke Method?


Parameters passed to Invoke Method:

Target object = new Dictionary (of String, Int 32). In this instance the dictionary name = dictionary_NumberOfTimesWon

Metod name = Add

The error still remains:

Error ‘Dictionary`2’ does not have a public instance method named ‘Add’ matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod ‘Invoke Method - adding winner…’.

Funny thing is, the training script from UiPath studio is exactly the same, but I don’t get this error when I open that file. If I write the smae script with my own variable names, I get this error. That is strange.


Here’s the file from the UiPath Academy course, the training script: Practice 3 - Dictionaries (Workflow).zip (2.2 KB)

And, here’s the one I wrote. It’s exactly the same, except the variable names. This one gives an error: (14.0 KB)

@kewakerukeli Can you check the parameters in the Properties section :sweat_smile:


The parameters for Invoke Method as in the properties sections are:


@kewakerukeli What values do you want to add to the dictionary ?


The Invoke Mehod in this example adds the names of the winner (key) and the number of times they won (value).

It’s in both the zip files. What I don’t understand is why the training script (from UiPath Academy) won’t give an error, but the same code, when I write it on my own, gives an error.

@kewakerukeli Can you click the Parameters and show me values included? :sweat_smile:

1 Like


Probably you should set parameter property of Invoke Method as the following.





Ok, got it now. Understood. There were no values in the parameters section of Invoke Method. Hence, the error.
Apologies. But, thanks to this discussion and @Yoichi’s illustration, I’ve understoon Invoke Method much better.



Got it. Thank you. Much clearer now.

1 Like

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