When a workflow on a SharePoint List is redeployed, and that workflow referenced an out-of-context SmartObject (a SmartObject from a different List), when it is packaged and deployed from one environment to another deployment fails and an error occurs.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at SourceCode.WebDesigner.Authoring.Forms.GenerateProcess.DoSPWrapping(Activity newActivity, XmlDocument inputData, String ConfigValues, String dynamicTypeForDestinationItem, K2Field currentField, SmartObjectFieldPart soFieldPart)
at SourceCode.WebDesigner.Authoring.Forms.GenerateProcess.CreateDestinations(XmlNode activity, Activity newActivity, XmlDocument xmlProcess, Process newProcess)
at SourceCode.WebDesigner.Authoring.Forms.GenerateProcess.CreateActivies(XmlDocument xmlInputData, XmlDocument xmlProcess, DefaultProcess& newProcess, String UserName)
at SourceCode.WebDesigner.Authoring.Forms.GenerateProcess.Generate(String LocalHostConnection, String UserName, Int32 ProcessID, String InputData, String ProcessXML, String SqlConnectionString, String HostServerConnectionString)
The packaged workflow had an ‘initialize data’ setting on the client event which consists of a concatenated string value that contains pipe “|” characters. This string value contains empty elements, Package and Deployment ignored the empty elements and compiled a faulty initialize string value for the workflow activity.