System.ArgumentException : The input workflow type must be an Activity.

Answered System.ArgumentException : The input workflow type must be an Activity.

  • Sunday, September 19, 2010 7:22 AM
     
      Has Code

    Hi everyone! I’m getting this error when starting up the workflow:

    System.ArgumentException : The input workflow type must be an Activity.
    Parameter name: workflowType

    The code I’m using is shown below:

    
    using (var wf = new WorkflowRuntime())
    {
      wf.WorkflowCompleted += (_, __) => signal.Set();
      wf.WorkflowTerminated += (_, __) => signal.Set();
      var args = new Dictionary<stringobject>();
      args.Add("Input", plainText);
      args.Add("Output"string.Empty);
      var inst = wf.CreateWorkflow(typeof (HtmlTypography), args);
      inst.Start();
      signal.WaitOne();
      return (string) args["Output"];
    }
    

    - Dmitri Nesteruk

All Replies

  • Sunday, September 19, 2010 2:54 PM
    Moderator
     
     
    Do you mean HtmlTypography is indeed a workflow but you are still getting the error? As suggested by the exception, we need the Type of a workflow to be passed to CreateWorkflow(). What is HtmlTypography?
    Cecilia Leung This posting is provided "AS IS" and confers no rights or warranties.
  • Saturday, September 25, 2010 2:50 PM
     
     

    Not sure who decided to mark this as answer since it's clearly isn't.

    I'm passing a very valid Activity into the method.


    - Dmitri Nesteruk
  • Sunday, September 26, 2010 1:20 AM
    Moderator
     
     Answered

    Hi Dmitri,

    I think the Activity you pass in is an type of  System.Activities.Activity , this type is supported from WF 4.

    And the WorkflowRuntime is a type from WF 3.5, WorkflowRuntime.CreateWorkflow needs an activity type from

    System.Workflow.ComponentModel.Activity.

    If you want to use WF4 feature, please use WorkflowApplication/WorkflowInvoker isntead of WorkflowRuntime.