Symptoms
"Stack Empty" error when trying to deploy a workflow
Stack empty.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Stack`1.Pop()
at SourceCode.Workflow.Design.SimpleRules.TreeConverter.ToExpressionTree(List`1 postfix)
at SourceCode.Workflow.Design.SimpleRuleFieldPart.get_ExpressionTree()
at SourceCode.Workflow.Design.SimpleRuleFieldPart.OnGetGetRuntimeData()
at SourceCode.Workflow.Authoring.K2FieldPart.SourceCode.Framework.Data.IRuntimeDataProvider.GetGetRuntimeData()
at SourceCode.Workflow.Authoring.K2Field.OnGetGetRuntimeData()
at SourceCode.Workflow.Authoring.K2FieldPart.SourceCode.Framework.Data.IRuntimeDataProvider.GetGetRuntimeData()
at SourceCode.Workflow.Authoring.Design.Serialization.ExecutableItemCodeGenerator.ExtenderCodeGenerator.Generate(CodeTypeDeclarationCollection types, GenerationOptions options)
at SourceCode.Workflow.Authoring.Design.Serialization.ProcessCodeGenerator.Generate(GenerationOptions options)
at SourceCode.Workflow.Authoring.Process.Compile()
at SourceCode.DeploymentTasks.Compiler.WorkflowCompiler.Execute()
Diagnoses
Deleting the first statement in the outcome configuration without removing any other statements leads to the operator ("and" or "Or") being left as the first item listed in the configuration, this extra operator causes the error when deploying the workflow.
Resolution
This is a confirmed bug and has been linked to TFS #680014.
The current workaround is to avoid deleting the first statement in the outcome configuration when possible, if the first statement does need to be deleted, all statements will have to be deleted and then rebuilt.