none
Custom WF: Workflow host activation failed for workflow definition id RRS feed

  • Question

  • Hi

    I'm building a custom workflow activity to retrieve an object reference from an XPATH filter, and want to populate Workflowdata with that reference.

    I have an MPR setup on a set transition, which triggers an action workflow.

    It consists of these activities:

    ReadCurrentRequest

    CodeActivity - Resolves Xpath grammar

    FindResources - (works with xpath, and returns a valid result)

    A "While Loop" goes through all the results (i only take the first one) and a code activity adds the reference to workflowdata.

    I can break step my code, and i can see the code getting called to add to workflow:

    containingWorkflow.WorkflowDictionary.Add("refTarget", "urn:uuid:b16cf423-353c-4749-8337-c91f26d53db3");

    (the urn, is actually a "UniqueIdentifier" type, I just filled out the values so you can see)

    This results in two Errors in the eventviewer, and PostProcessesingError on my requests.

    Workflow host activation failed for workflow definition id : 5d0d637b-9fff-40c8-8227-bb4a85fc3053, version key: 179. Exception: Object reference not set to an instance of an object.   at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.ActivateHost(ResourceManagementWorkflowDefinition workflowDefinition, Boolean suspendWorkflowStartupAndTimerOperations)
       at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.RetrieveWorkflowDataForHostActivator()
    Workflow host activation failed for workflow definition id : 5d0d637b-9fff-40c8-8227-bb4a85fc3053, version key: 180. Exception: Object reference not set to an instance of an object.   at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.ActivateHost(ResourceManagementWorkflowDefinition workflowDefinition, Boolean suspendWorkflowStartupAndTimerOperations)
       at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.RetrieveWorkflowDataForHostActivator()

    I cant find any posts about "Workflow host activation failed"

    If i try to search for the id given, nothing is returned.

    I have another WF Activity after my custom one, to email me the variables returned. But it is not sent.

    Any help is greatly appreciated,

    best regards, Daniel

    Friday, October 26, 2012 8:55 AM

Answers

All replies

  • Some pictures


    Friday, October 26, 2012 9:45 AM
  • Hi,

    I would say two things....

    1. Your problem may be related to Activity Execution contex of WF. In nutshell WF has actiivity execution context. Each time Whileloop iterates it creates a new instance of activiites placed in it with new child execution context. I think you can explore here if you haven't already http://msdn.microsoft.com/en-us/magazine/cc163414.aspx

    2. Why dont you use EnumerateResouceActivity? It is very easy and looks like you can implement what you are trying with EnumerateResourceActivity.

    Thanks,
    Bhavesh

    Friday, October 26, 2012 2:58 PM
  • There is/(was?) an issue with adding GUIDs to the WF dictionary. Try adding an arbitrary non-guid value and see if your problem still repro's.

    My Book - Active Directory, 4th Edition
    My Blog - www.briandesmond.com

    Friday, October 26, 2012 6:58 PM
    Moderator
  • try this instead..

                    SequentialWorkflow parentWorkflow = null;
                    SequentialWorkflow.TryGetContainingWorkflow(this, out parentWorkflow);
                    parentWorkflow.WorkflowDictionary.Add("KeyNameGoesHere", "valueGoesHere");

    and also try that code inside and outside your loop and see if they refer to the same thing. It could be that your activity may be the 'containing' workflow instead of the next level up container. Perhaps a class-level GUID can be defined to hold the result that you generate inside your while loop and then set the workflowdata outside of the loop in a follow-on code activity.


    Frank C. Drewes III - Architect - Oxford Computer Group




    Friday, October 26, 2012 9:57 PM
  • Thanks for your replies.

    @ Frank


    In the while loop, and outside the while loop. The containing workflow returned the same content.

    I don't update the workflowdata in the loop, but rather, as you also point out, i save the value I want in the while loop in a variable defined on the workflow activity(global) and reference that in my last code activity.(because I really just want 1 value)



    @ Brian


    Replacing the GUID object with a string works like a charm. Also changing it to a List<UniqueIdentifier> works aswell.

    For lack of better options, I guess this will be my solution, and I will have to code the rest of my activities to work with a list of objects

    Monday, October 29, 2012 11:20 AM