locked
Bug in OnTaskCreated Activity ? RRS feed

  • Question

  • ne

    .WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     --- End of inner exception stack trace ---     at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     at Microsoft.SharePoint.Workflow.SPWinOETaskService.RaiseEvent(SPWinOeWorkflow workflow, SPWorkflowEvent workflowEvent, Object workItem, IPendingWork.workHandler)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.Send(SPWinOeWorkflow winoeworkflow, SPWorkflowEvent e)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)         


    • Edited by Mike Walsh FIN Tuesday, May 10, 2011 6:06 AM One ? in Title only
    Thursday, June 21, 2007 4:20 PM

Answers

  • It seems that this is the Bug with the OnTaskCreated activity as we debugged and check all the things but couldn't find the cause of error.

    But Good news is that...We found one work-around for this issue....with the following 2 steps !!!

    -->We disabled the OnTaskCreated activity

    --> Developed an Event Handler and attached it to the ItemAdded event of the TASK List to get the newly added task ID and update the form library TaskURL column.

     

    Now it is working perfectly

     

     

    Thursday, August 30, 2007 8:05 AM
  • Know this answer if a few years late, but i had the same problem, and this was the first post google showed me. The solution i found was to restart windows SharePoint timer service.

    Root cause was, whenever you have workflow that has got a delay activity, the event is fired by the service(SPTimerV3), before it fires, it has to load the assembly from its bin or from the GAC, only one file(module loads) based on the assembly information specified in workflow.xml file loads.

    Deploying the new binary after changing the workflow activities, the SPTimerV3 is not aware of the newly added binary; it won’t reload it unless you do a time reset. Unless you do a reset, the persistence (serialization or de-serialization) or loading of assembly would fail due to mismatch of types.

     

     

    Credit to: http://social.msdn.microsoft.com/Forums/en/sharepointworkflow/thread/8e278e32-9cb9-4afb-a5b0-8ac77d33e59f

    Monday, May 9, 2011 11:59 AM

All replies

  • Further to the above , Now what I've observed  that  SOMETIMES  OnTaskCreated Activity is not  firing . and when I press F5 on my DocLib page still the column is nt getting updated as that code is inside OnTaskCreated Mathod. But interstingly after 5-6 minnuts when Refresh the same page , the column is getting updated. I have no clue about this behaviour :-(

     

    Please help me if anyone has  clues....

    Thursday, June 21, 2007 11:22 PM
  • I'm sure you've already checked your correlation tokens, but that doesn't seem to be the issue here...

     

    Can you post the code of your task activities (all of them: createTask, onTaskCreated, onTaskChanged, TaskCompleted). Perhaps we can find something in there that's blowing it up. I want to say my problem was a timer issue, because my code stepped through like it should have, but SharePoint threw errors. Since I never resolved the original problem, I'll try my best to help, but as I had said I found a workaround, so maybe we can do the same in your case.

     

    Aaron

    Tuesday, July 3, 2007 2:14 PM
  • Dear Aaron,

     

    I am having the ECM CollectFeedBack example . The only difference is that I m having CreateTaskWithContentType,OnTaskCreated,OntaskChanged,CompleteteTask inside a while loop. one more thing which I am doing is I am updaing workflowProperites.Item[someColumn]  inside CompleteTask as well as in OntaskChange. The problem still persists

    Thursday, July 26, 2007 7:19 AM
  •  

    have you tried attaching to the workflow process and debugging? It might take you to the exception that is getting thrown.
    Tuesday, July 31, 2007 3:23 PM
  • Wow, I'm experiancing a problem with this same exact senario. I have CreateTask, OnTaskCreated, OnTaskChanged, and CompleteTask all contained within a SequenceActivity contained within a WhileActvity.  While attaching to the debugger and stepping through the code, the second time through the while loop it will never get to the OnTaskCreated activity and does not throw an error or a Workflow Fault.  Furthermore, the workflow history adds two items that state failed to run.  Like Baly states in his workflow, I wait about 5-6 minutes and it looks like it recovers, but not always.

     

    If I disable the OnTaskCreated activity, everything works fine without a problem.  As soon as I renable the activity the problem returns.  I do not have any code associated with the OnTaskCreated activity Invoked Handler because I am just interested int the AfterProperties so that I can obtain the TaskItemId in a subsequent activity.

     

    I also have begun to wonder if there is a bug with the OnTaskCreated activity.  If this were true, it would not be the first activity with a bug, there was a previous bug with the delay activity that has since had a patch released.

    Tuesday, July 31, 2007 6:57 PM
  • You may check to see if the values are pulling in correctly from the task form...make sure the form is setup correctly.

     

    Tuesday, July 31, 2007 7:16 PM
  • Has anyone reached any resolution to this issue? Does the SP Workflow team know about this?  Any news would be greatly appreciated.

    Wednesday, August 15, 2007 7:40 PM
  • It seems that this is the Bug with the OnTaskCreated activity as we debugged and check all the things but couldn't find the cause of error.

    But Good news is that...We found one work-around for this issue....with the following 2 steps !!!

    -->We disabled the OnTaskCreated activity

    --> Developed an Event Handler and attached it to the ItemAdded event of the TASK List to get the newly added task ID and update the form library TaskURL column.

     

    Now it is working perfectly

     

     

    Thursday, August 30, 2007 8:05 AM
  • Hi Baly

    I am struggling with it since morning. The event fires randomely . I dont think it is code or task tokens related.

    The requirement that I have is to remove existing users ( remove Inheritence) and add different users to the List Item that has been created and i am using the on Task created event to do this but this one is not consistent at all. Fires almost 1 in 3 times. I am Clueless on what is going on.

     

    Can you share with me about the workaround that you came up with .I would like to not to use OnTaskCreated if possible for the above requirement

     

    private void SupervisorApprovalAfterTaskCreated_Event(object sender, ExternalDataEventArgs e)

    {

    SPListItem ListItem = workflowProperties.TaskList.GetItemById(ApproverTaskProperties_After.TaskItemId);

    TaskListAddRemovePermissions(ListItem, ItemApprover);

    }

     

    Thanks In advance

    Vikram

    Friday, August 31, 2007 10:12 PM
  • Hi Vikram,

     

    Since the OnTaskCreated is giving problems, I would suggest to invoke TaskListAddRemovePermission()  from a Event Handler . You can attached the Event Handler to the Task-List on the ItemAdded event and get the latest task ID.

     

    -Baly

    Monday, September 3, 2007 6:02 AM
  • Hi

     

    I have recently encountered the same issue with the OnTaskCreated Event. It fires randomly and its causing me a headache.

     

    Could you please provide more info on how to create the event handler and use it in the existing workflow

     

    Thanks

     

    John 

     

    Thursday, April 10, 2008 10:14 AM
  •  

    please write code sample for your solution of the problem!!!
    Thursday, April 17, 2008 2:51 PM
  • Can anyone write a sample code how to create  event handler to fix this error in OnTaskCreated ? Please help
    • Proposed as answer by prathalye Sunday, November 14, 2010 3:26 PM
    • Unproposed as answer by Mike Walsh FIN Tuesday, May 10, 2011 6:05 AM
    Wednesday, May 12, 2010 7:52 AM
  • Hi,

    below code is the solution  to your problem:

    Remove the ontaskcreated from the WF designer surface and assign the ListItemId  property of the CreateTaskwithContentType to a int32 dattype as  given below:

    public  string mTaskId = createTaskWithContentType1_ListItemId1.ToString();

    Int32 createTaskWithContentType1_ListItemId1 = default(System.Int32);

    Now  you can access the strURL as:

    strURL = workflowProperties.WebUrl +

    "/Lists/MTasksList/DispForm.aspx?ID=" + mTaskId ;

    you will get the url of the next approver's task.

    HTH

    PrasadWT


    --------------------------------------------------------------------------------


    PrasadWT
    • Proposed as answer by PrasadWT Tuesday, May 25, 2010 1:07 PM
    • Unproposed as answer by Mike Walsh FIN Tuesday, May 10, 2011 6:05 AM
    Tuesday, May 25, 2010 1:07 PM
  • PrasadWT's solution was exactly what I needed. I've been looking for weeks now... Thanks!
    Friday, November 5, 2010 3:59 PM
  • Know this answer if a few years late, but i had the same problem, and this was the first post google showed me. The solution i found was to restart windows SharePoint timer service.

    Root cause was, whenever you have workflow that has got a delay activity, the event is fired by the service(SPTimerV3), before it fires, it has to load the assembly from its bin or from the GAC, only one file(module loads) based on the assembly information specified in workflow.xml file loads.

    Deploying the new binary after changing the workflow activities, the SPTimerV3 is not aware of the newly added binary; it won’t reload it unless you do a time reset. Unless you do a reset, the persistence (serialization or de-serialization) or loading of assembly would fail due to mismatch of types.

     

     

    Credit to: http://social.msdn.microsoft.com/Forums/en/sharepointworkflow/thread/8e278e32-9cb9-4afb-a5b0-8ac77d33e59f

    Monday, May 9, 2011 11:59 AM