Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
WorkflowInstance instance = workflowRuntime.CreateWorkflow(type);

getting an error

Stack trace
[ArgumentException: The input workflow type must be an Activity.
Parameter name: workflowType]
   System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(Type workflowType) +1327127
   WorkflowTest._Default.WFInvoke_Click(Object sender, EventArgs e) in F:\WCF\WFLibrary\GuessNumberGameInSequence\WorkflowTest\Default.aspx.cs:50
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Posted
Updated 18-Jul-12 23:41pm
v2

1 solution

The input workflow type must be an Activity.
'type' used by you to instantiate Workflownstance is not of type 'Activity'.

C#
WorkflowInstance instance = workflowRuntime.CreateWorkflow(OBJECT_HERE_OF_ACTIVITY_TYPE); //


I guess you simply copied code from here: MSDN: WorkflowInstance[^], but you need to first define 'type'. Example here was part of sample present here: MSDN: Cancelling Work sample[^]
 
Share this answer
 
Comments
Nareshnani 19-Jul-12 7:50am    
WorkflowRuntime workflowRuntime = Application["WorkflowRuntime"] as WorkflowRuntime;
ManualWorkflowSchedulerService manualScheduler = workflowRuntime.GetService(typeof(ManualWorkflowSchedulerService)) as ManualWorkflowSchedulerService;
Type type = typeof(WF_Library.Activity1);
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WF_Library.Activity1));
instance.Start();
manualScheduler.RunWorkflow(instance.InstanceId);
-->Still i am getting same error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900