I am getting a NullReferenceException at the start of the process.
“Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized).”
It does not point to any activity. The error points to the start of the process. I am not sure if this explains the error clearly. Please let me know if any additional information is needed. Thanks in advance
In addition to what Dill said, make sure that you don’t have arguments and variables named the same. Uipath always uses the most “local” value and variables are considered more local than arguments. I’ve spent quite a bit of time trying to figure out why arguments being passed don’t work, only to realize that I have an empty variable of the same name that I forgot to delete
The scenario is such that I don’t have variables and arguments of the same name.
Also, since i need only two argument passed, I use the arguments directly without assigning them to a local variable.
I am sorry Dave. I cannot upload or share screenshots of the code.
However, this is the screenshot of the Variable/Arguments from the process and the arguments from the invoke activity.
That screenshot is just the invoked code. It is impossible for us to know if the strings “mvaNumber” or “accessoryList” have any values associated with them. We’d need to see the main workflow, or at least the piece that is supposed to be assigning values to these 2 variables being passed.
This error means that your invoked workflow expects a value for one of these variables, but is just getting a null reference, meaning that the variables weren’t initialized in the main workflow
If you set the default values of those 2 variables to “” in your MAIN workflow (the one containing the invoke activity), it should get rid of your null reference error, and then when the workflow continues you might be able to pinpoint which variable is not being initialized (it will be the one that is still “” by the end, or you could use debug mode and watch the local values carefully)
I think you should re-read what KEntwistie wrote. It is a great way to debug arguments.
The exception comes up BECAUSE there are no values in the argument. You want to provide a default value that is different than the value you expect. Then, when you run the invoked workflow, if either of the arguments = the default value, you know that the values weren’t set properly in the main workflow
Object reference not set to an instance of an object → this might be possible when you copy paste your xaml file into one step lower the folder level.
example:
“C:\Users<userName>\Documents\UiPath\Sample1.xaml” → when you are getting error on this level then create one more folder and access your xaml script as follows:
“C:\Users<userName>\Documents\UiPath\ NewFolder \Sample1.xaml”
Thank you all for your suggestions. But, it turns out that the error was not caused at the “Invocation” of the workflow. I was using a few String arrays and they were unassigned. That was causing the error. And since they were part assigned in an If condition, they were never always initialized. When I changed the String array to a String list, it worked as expected