locked
CSharpReference and WorkflowInvoker error: TextExpressionCompiler doesn't compile RRS feed

  • Question

  • If I run just

    WorkflowInvoker.Invoke(rootActivity);

    I'll have an error with CSharpReference inside rootActivity that it must be compiled. The only solution I could find is explained here. But when I try it a have TextExpressionCompilerResults with errors. The generate code contains:

    public partial class DebuggingActivity : System.Activities.XamlIntegration.ICompiledExpressionRoot {
        
        private System.Activities.Activity rootActivity;
        
        private object dataContextActivities;
        
        private bool forImplementation = true;
        
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Activities", "4.0.0.0")]
        [System.ComponentModel.BrowsableAttribute(false)]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
        public string GetLanguage() {
            return "C#";
        }
        
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Activities", "4.0.0.0")]
        [System.ComponentModel.BrowsableAttribute(false)]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
        public object InvokeExpression(int expressionId, System.Collections.Generic.IList<System.Activities.LocationReference> locations, System.Activities.ActivityContext activityContext) {
            if ((this.rootActivity == null)) {
                this.rootActivity = this;
            }
            return null;
        }
        
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Activities", "4.0.0.0")]
        [System.ComponentModel.BrowsableAttribute(false)]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
        public object InvokeExpression(int expressionId, System.Collections.Generic.IList<System.Activities.Location> locations) {
            if ((this.rootActivity == null)) {
                this.rootActivity = this;
            }
            return null;
        }

    It's easy to see the code isn't comiplable 'cause it has assignment to an Activity type variable of the class that isn't inherited from Activity. By the way I can't run as in the example the following line:

    System.Activities.XamlIntegration.ICompiledExpressionRoot compiledExpressionRoot = Activator.CreateInstance(activityType, new object[] { rootActivity }) as System.Activities.XamlIntegration.ICompiledExpressionRoot;
    'cause there is no such constructor in the generated class. How to make the generated code compilable and applyable with the root activity of the workflow?

    Monday, February 2, 2015 10:09 AM

Answers

All replies