Hi,
I`m gettin the following exception while invoking my workflow (dynamically):
The following errors were encountered while processing the workflow tree: 'DynamicActivity': The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "TryCast(simplerule_out,OutputBase2)". Type 'OutputBase2' is not defined.
'DynamicActivity': The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "Res". Type 'OutputBase2' is not defined.
'DynamicActivity': The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "Res". Type 'OutputBase2' is not defined.
'DynamicActivity': The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "New List(Of OutputBase2)". Type 'OutputBase2' is not defined.
The workflow is very simple and worked fine on VS 2010 beta 2!
All I`m trying to do is to create new list of my abstract custom type "OutputBase2".
public class OutputBase2
{
public OutputBase2() { }
public bool Succeeded { get; set; }
}
class Example
{
public void Exec()
{
ActivityBuilder builder = new ActivityBuilder();
builder.Name = "act1";
var res = new DynamicActivityProperty { Name = "Res", Type = typeof(OutArgument<List<OutputBase2>>), Value = new OutArgument<List<OutputBase2>>() };
builder.Properties.Add(res);
builder.Implementation = new Sequence();
((Sequence)builder.Implementation).Activities.Add(new Assign<List<OutputBase2>> { To = new VisualBasicReference<List<OutputBase2>> { ExpressionText = res.Name }, Value = new VisualBasicValue<List<OutputBase2>>("New List(Of OutputBase2)") });
Activity act = getActivity(builder);
var res2 = WorkflowInvoker.Invoke(act);
}
string getXamlStringFromActivityBuilder(ActivityBuilder activityBuilder)
{
string xamlString;
StringBuilder stringBuilder = new StringBuilder();
System.IO.StringWriter stringWriter = new System.IO.StringWriter(stringBuilder);
System.Xaml.XamlSchemaContext xamlSchemaContext = new System.Xaml.XamlSchemaContext();
System.Xaml.XamlXmlWriter xamlXmlWriter = new System.Xaml.XamlXmlWriter(stringWriter, xamlSchemaContext);
System.Xaml.XamlWriter xamlWriter = System.Activities.XamlIntegration.ActivityXamlServices.CreateBuilderWriter(xamlXmlWriter);
System.Xaml.XamlServices.Save(xamlWriter, activityBuilder);
xamlString = stringBuilder.ToString();
return xamlString;
}
public Activity getActivity(ActivityBuilder t)
{
string xamlString = getXamlStringFromActivityBuilder(t);
System.IO.StringReader stringReader = new System.IO.StringReader(xamlString);
Activity activity = System.Activities.XamlIntegration.ActivityXamlServices.Load(stringReader);
return activity;
}
}