When a client side activity, such as an Alert, is used in a workflow, all of the variables that are in scope will get serialized.
Unfortunately, there are a number of ESRI types that are not serializable. These are most commonly found in the results of ArcGIS Server tasks, such as the Route task and Geoprocessing task. Workflow will throw an exception when it tries to serialize these variables.
To avoid this error and have the workflow complete successfully, you will need to make sure that any objects that are the result of the ESRI task either go out of scope, or are set to null before any client side activities. For example, if we want to view the number of GPMessages returned after the Geoprocessing Task completes in the workflow above, messages.Count.ToString() can be stored in a new string variable, and then we can send the GPMessages variable to Nothing.
Now, when the workflow is run, the GPMessages variable won't be serialized, and the workflow will complete without errors.
Article is closed for comments.