Beta 2.2. Upgrade issue
Does anyone know what would be causing the following when starting a new workflow?
Global.asx.cs
System.Workflow.Runtime.
WorkflowRuntime workflowRuntime =new System.Workflow.Runtime.WorkflowRuntime();Application["WorkflowRuntime"] = workflowRuntime;
workflowRuntime.StopRuntime();
workflowRuntime.AddService(new System.Workflow.Runtime.Tracking.SqlTrackingService(System.Configuration.ConfigurationManager.AppSettings["cs_tracking"].ToString()));
System.Collections.Specialized.NameValueCollection hashTable =new System.Collections.Specialized.NameValueCollection();
hashTable.Add("UnloadOnIdle","true");
hashTable.Add("ConnectionString", System.Configuration.ConfigurationManager.AppSettings["cs_persistance"].ToString());
System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService sqlPersistenceSvc =newSqlWorkflowPersistenceService(hashTable);
workflowRuntime.AddService(sqlPersistenceSvc);
workflowRuntime.AddService(new Mimi.SL.MimiWorkFlow.WFSessionFactory());
workflowRuntime.StartRuntime();
-
This is the code I am using to run the workflow....
WorkflowRuntime workflowRuntime = (System.Workflow.Runtime.WorkflowRuntime)System.Web.HttpContext.Current.Application["WorkflowRuntime"];protected System.Workflow.Runtime.WorkflowInstance workFlowInstance =null;System.Collections.Generic.Dictionary<string,object> parameters =new System.Collections.Generic.Dictionary<string,object>();
parameters.Add("AppId",this.App.Id);
parameters.Add("WorkListId",this._activeWorkList.Id);
WorkflowInstance workflowInstance;
workflowInstance = workflowRuntime.CreateWorkflow(Type.GetType(dotNetWorkflow.WorkFlowType), parameters);
this.dotNetWorkflow.InstanceId = workflowInstance.InstanceId.ToString();
this.dotNetWorkflow.Status = StateMachine.Stat.InProgress;
this.dotNetWorkflow.Error =null;
this.Session.SaveOrUpdate(this.dotNetWorkflow);
this.Session.Flush();
workflowInstance.Start();
An item with the same key has already been added.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details:System.ArgumentException: An item with the same key has already been added.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: |
Stack Trace:
[ArgumentException: An item with the same key has already been added.] System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +48 System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +1010705 System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +21 System.Workflow.Runtime.TrackingListenerFactory.WorkflowExecutorInitializing(Object sender, WorkflowExecutorInitializingEventArgs e) +843 System.EventHandler`1.Invoke(Object sender, TEventArgs e) +0 System.Workflow.Runtime.WorkflowRuntime.WorkflowExecutorCreated(WorkflowExecutor workflowExecutor, Boolean loaded) +48 System.Workflow.Runtime.WorkflowExecutor.RegisterWithRuntime(WorkflowRuntime workflowRuntime) +235 System.Workflow.Runtime.WorkflowRuntime.RegisterExecutor(Boolean isActivation, WorkflowExecutor executor) +22 System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance) +634 System.Workflow.Runtime.WorkflowRuntime.GetWorkflowExecutor(Guid instanceId, CreationContext context) +558 System.Workflow.Runtime.WorkflowRuntime.InternalCreateWorkflow(CreationContext context, Guid instanceId) +49 System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(Type workflowType, Dictionary`2 namedArgumentValues, Guid instanceId) +92 System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(Type workflowType, Dictionary`2 namedArgumentValues) +46 WorkListForms_DotNetWorkFlow.workflowStart_Click(Object sender, EventArgs e) +172 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 |

