locked
Issue getting the instance of newly created workflow RRS feed

  • Question

  • Hello,

    I am starting a new workflow for my item and then try to get the instance of StateMachineWorkflowInstance for that newly created workflow. This works for around 60% of time. but for rest of the time I get the strange error. I am not sure why this is happening.

    Also, This happens when I start more than 10 workflow at the same time. If I go one by one this doesn't happen. Below is the exception message, Stack Trace and line that is generating the error.

    Line:

    StateMachineWorkflowInstance targetStateMachineInstance = new StateMachineWorkflowInstance(WFRuntime, new Guid(WorkflowInstanceID));

    Exception:

    Message:
    Object of type 'Vendor_WF1 cannot be converted to type 'Vendor_WF1'. - Vendor_WF1 is my workflow name.

    Stack :
       at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
       at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency)
       at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck)
       at System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo fi, Object target, Object value)
       at System.Runtime.Serialization.FormatterServices.PopulateObjectMembers(Object obj, MemberInfo[] members, Object[] data)
       at System.Workflow.ComponentModel.Serialization.ActivitySurrogate.ActivitySerializedRef.System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(Object sender)
       at System.Runtime.Serialization.DeserializationEventHandler.Invoke(Object sender)
       at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent()
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
       at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)
       at System.Workflow.ComponentModel.Activity.Clone()
       at System.Workflow.Runtime.WorkflowExecutor.GetWorkflowDefinitionClone(String workflowContext)
       at System.Workflow.Runtime.WorkflowInstance.GetWorkflowDefinition()
       at System.Workflow.Activities.StateMachineWorkflowInstance..ctor(WorkflowRuntime runtime, Guid instanceId)
       at PaperSave.PaperSaveApplication.SetQueueItemsToCompleteAndMoveToQueue(List`1 RelatedQueueItems, WorkflowQueues TargetQueue, Boolean ChangeQueueItemStateBoforeMoving, String NonStaticExecutingUser, Boolean RaiseCreatedEvent) in E:\Devlopment\PaperSave5.1\PaperSave\Application\Business Logic\PaperSaveApplication.cs:line 558

    I am looking forward for the help...

    Thanks

    Himal


    Himal

    Monday, March 26, 2012 6:00 AM