I'm using Windows Workflow 4.0 and have a simple workflow where in a sequence I have a ForEach activity which contains another ForEach activity that contains a child activity that performs some action on a remote client.
I am capturing Activity Scheduled tracking records (as well as pretty much every other tracking record type).
My goal is to use these activity scheduled tracking records to create a page where I show each activity and how long it took executing (similar to how the TFS build information screen looks).
My issue is that when looking at the child activity ids for the ForEach children they're assigned the same Id for each iteration of the loop. Therefore I cannot accurately match up any tracking events to a specific child. In other words, the child of the nested ForEach does remote processing which generates logs that are tied to the activity id. I cannot match those logs with a specific activity within the loop.
Is there something I'm missing? I thought activity id was supposed to be unique throughout the workflow.
Turns out there is an additional property on the ActivityInfo object that I wasn't "tracking". InstanceId does not refer to the workflow instance id but instead it is an instance of the ActivityId.
Essentially you have only one activity in the diagram but it can have multiple instances (if I'm understanding this correctly).