Share via


Tracking Child Workflow with InvokeWorkflow

For background on this issue see WF4 How To Invoke a Child Workflow as XAML.  Thanks to rfcdejong who recently logged an issue on our https://wf.CodePlex.com site Child activity's ignore the Tracking Participant / Tracking Profile ?

Because of this feedback I’m adding support for tracking to InvokeWorkflow.  Adding this was not trivial work and required some very interesting code but I was able to do it and you can see from the before and after test runs that it works.

Before

Here is the tracking data from the test run of InvokeWorkflowTest.InvokeWorkflowShouldInvokeInner without the support for tracking.  In this tracking data all you see is the tracking for the parent workflow.

 *** Tracking data follows ***
 WorkflowInstance <InvokeWorkflow> is <Started> at 07:37:15.3919
 Activity <null> is scheduled child activity <InvokeWorkflow> at 07:37:15.3919
 Activity <InvokeWorkflow> state is Executing at 07:37:15.3919
 {
     Arguments
         Activity: 1: TestInnerActivity
         Input: System.Collections.Generic.Dictionary`2[System.String,System.Object]
         Timeout: 00:00:00
 }
 WorkflowInstance <InvokeWorkflow> is <Idle> at 07:37:15.4049
 Activity <InvokeWorkflow> state is Closed at 07:37:15.4079
 {
     Arguments
         Activity: 1: TestInnerActivity
         Input: System.Collections.Generic.Dictionary`2[System.String,System.Object]
         Timeout: 00:00:00
         Result: System.Collections.Generic.Dictionary`2[System.String,System.Object]
 }
 WorkflowInstance <InvokeWorkflow> is <Completed> at 07:37:15.4079

After

In this tracking data you see the inner workflow (named TestInnerActivity) being started (line 11) and completed (line 50) nested inside of the InvokeWorkflow activities started and completed

    1: WorkflowInstance <InvokeWorkflow> is <Started> at 07:53:09.3125
    2: Activity <null> is scheduled child activity <InvokeWorkflow> at 07:53:09.3135
    3: Activity <InvokeWorkflow> state is Executing at 07:53:09.3135
    4: {
    5:     Arguments
    6:         Activity: 1: TestInnerActivity
    7:         Input: System.Collections.Generic.Dictionary`2[System.String,System.Object]
    8:         Timeout: 00:00:00
    9: }
   10: WorkflowInstance <InvokeWorkflow> is <Idle> at 07:53:09.3175
   11: WorkflowInstance <TestInnerActivity> is <Started> at 07:53:09.3165
   12: Activity <null> is scheduled child activity <TestInnerActivity> at 07:53:09.3165
   13: Activity <TestInnerActivity> state is Executing at 07:53:09.3165
   14: {
   15:     Arguments
   16:         Num: 1
   17: }
   18: Activity <TestInnerActivity> is scheduled child activity <Sequence> at 07:53:09.3165
   19: Activity <Sequence> state is Executing at 07:53:09.3165
   20: Activity <Sequence> is scheduled child activity <If> at 07:53:09.3165
   21: Activity <If> state is Executing at 07:53:09.3175
   22: {
   23:     Arguments
   24:         Condition: False
   25: }
   26: Activity <If> is scheduled child activity <Assign<Int32>> at 07:53:09.3175
   27: Activity <Assign<Int32>> state is Executing at 07:53:09.3175
   28: {
   29:     Arguments
   30:         Value: 2
   31: }
   32: Activity <Assign<Int32>> state is Closed at 07:53:09.3175
   33: {
   34:     Arguments
   35:         Value: 2
   36:         To: 2
   37: }
   38: Activity <If> state is Closed at 07:53:09.3175
   39: {
   40:     Arguments
   41:         Condition: False
   42: }
   43: Activity <Sequence> state is Closed at 07:53:09.3175
   44: Activity <TestInnerActivity> state is Closed at 07:53:09.3175
   45: {
   46:     Arguments
   47:         Num: 1
   48:         Result: 2
   49: }
   50: WorkflowInstance <TestInnerActivity> is <Completed> at 07:53:09.3175
   51: Activity <InvokeWorkflow> state is Closed at 07:53:09.3555
   52: {
   53:     Arguments
   54:         Activity: 1: TestInnerActivity
   55:         Input: System.Collections.Generic.Dictionary`2[System.String,System.Object]
   56:         Timeout: 00:00:00
   57:         Result: System.Collections.Generic.Dictionary`2[System.String,System.Object]
   58: }
   59: WorkflowInstance <InvokeWorkflow> is <Completed> at 07:53:09.3555

I’ve fixed this issue in Microsoft.Activities v1.8.3 now available on NuGet