I am trying to run just a few workflows in the process portion of my framework. However, when I run I receive this error message
“Message: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized).”
I have received this before but I do not remember the exact cause or the best practice to fix it. I am not sure if I have to put in default values for my arguments (which are dictionaries mostly). Please help!
You are correct that you need to assign a value to the in arguments if you are trying to execute the process XAML on it’s own. You could also try invoking it from another workflow and passing the values that way.
If you use the dictionary throughout your framework, then you will need to start it from the beginning even when testing specific parts. So, in your Process state, you would need to design it in a way where you can only perform certain workflows (like using a switch or just draw your arrow to certain workflows for example). Then run it from your Framework so it picks up the dictionary settings.
It will be beneficial to pass dictionary values individually to workflows’ arguments rather than only the entire dictionary. That way, you can run each workflow independently by setting default values in the Arguments.
What you are saying probably makes total sense. I am just somewhat new to Uipath and the framework so I guess I am not understanding the fix you are describing.
Here is an example of something you can do in your Process portion.
Replace the Sequence inside the Try Catch with a “Flowchart” instead…
And you’ll get something like this:
Is this equivalent to just commenting out the sequences I don’t want? That is what I have been doing. Its running the right processes, I’m just getting the error because of something with my dictionaries not referencing anything.
The workflow arguments are OUT type. So just initializing them will not help here (my guess).
Create a test workflow Test.xaml and from there Invoke Process.xaml passing all arguments properly (In or Out). This is the way you may test the individual workflow.
Ya, you are correct. You will need to find out the point right before you get the error and which variable is causing it. (like using Message Boxes to pause workflow). You can display if a variable has a value like this: (variable is nothing).tostring //should be false if it has something in it
Once you know where and which variable, then backtrack to where it gets initialized so you can figure out why it did not get initialized. Keep in mind that to pass a variable “in” an invoke, it will need to be an In argument.