Comments (2)

  1. tilovell09 says:

    ZOMG someone has linked to one of my posts. :p

    And there you can see CacheMetadata in action, instead of trying to follow my meandering train of thought.,guid,c3394709-1aaf-486a-8d1f-51050ce94ecc.aspx


  2. Over time a few folks have asked on the forum for information about writing rehosted visual workflow debugger applications (a.k.a. workflow simulator, a.k.a. visual workflow tracking…). Many of these folks have already seen the Visual Workflow Tracking sample (MSDN) , and even read at least one of Kushal’s related blog posts ( “Debugging in Workflow 4.0” , “VisualWorkflowTracking aka Workflow Simulator” , and “Visual Workflow Tracking with Step Service” ). But since it’s still a reasonably popular subject to ask questions on it seems like a good time to rehash it, and add a little information on very closely related subjects.   1 – General Limitations At first glance (at the pictures) the Visual Workflow Tracking samples might appear to show a debugging experience extremely similar to the workflow debugging experience Visual Studio. Now actually it is different, and while it is true that the two scenarios rely on some of the same code, one significant difference to be aware of is that Visual Studio is literally debugging the activities as you run because it has information about which activity is executing gained because it is attaching as a debugger . This is immediately different from the Visual Workflow Tracking sample which is working based on a completely different source of information about workflow execution, namely data from the Workflow 4.0 ‘Tracking‘ feature (for a very quick intro on the Tracking feature see here , but please note that it refers to Beta 1 of .Net 4.0, not the final release. Also see the MSDN description which refers to the actual release). This means you might not be able to easily implement every debugging feature you are familiar with such as breakpoints, or if you can implement them that they may end up needing to behave slightly different to the Visual Studio behavior. Now most parts of the sample code are useful no matter you get information about the currently executing state of the workflow – if you get creative it could be something completely different from workflow tracking. However, there is one more limitation of the sample code, which many people will want to overcome. The sample itself contains a workflow which executed live and in the same process as the visual workflow tracker. In many cases customers are interested in doing something which is not the same, what they actually want to do is allow a) visualizing a workflow which ran in a different process (e.g. on a server machine) or b) replay of a workflow which finished executing some time in the past. The impact of this is that instead of working from an Activity object , which is available as part of the TrackingRecord (on the derived subclasses) received by Participants, as the initial input into figuring out which activity is executing and needs displaying in the debugger, instead one must work with whatever Activity tracking data the TrackingParticipant saves to a database or log, which would typically include not the Activity object itself (this wouldn’t do what we want), instead it would usually include information such as an Activity ID.   2 – Activity IDs OK, that’s great but what is an Activity ID? Well, it’s actually a special  string. Here’s a concrete example that I totally made up and might even look wrong: “” The important part of the example which isn’t wrong is that an Activity ID is just a series of numbers – numbers of significance! The numbers are in fact a path in your Activity tree. This is basically just like a file system path, “C:foobartempreadme.txt”, so it refers to a unique entity within a tree, and a given Activity ID always refers to a particular Activity as long as you are talking about the same exact workflow. Yes, I need to clarify that. It has to be the same exact workflow (workflow structure, not workflow instance) for two reasons. First reason: Look at the Activity ID string again. “” is really, when interpreted as a suffix instead of a complete string, jus