Morning Coffee 18

  • I’m sure glad Heroes is back. And so far, I’m liking this season of 24 better than the last couple. I especially like how they’re introducing Jack’s family to the storyline – very cool.
  • Bill Gates will be onThe Daily Show with Jon Stewart next Monday. I rarely miss an episode (though I typically watch it a day or two later via my DVR) so I’m looking forward to this.
  • Roger Sessions latest ObjectWatch newsletter is available. Roger does his usual brand of relating architectural concepts to everyday situations (this time, planning his daughter’s wedding). This one was funnier than most – especially since I have a 1 year old daughter – though I’m still waiting for one of these that doesn’t contain the words “doppio machiato”. If you’re reading this Roger, don’t worry, I am enjoying every moment.
  • Apparently, I am the keeper of obscure development knowledge on my team. My teammate Buzz was getting an error in shdocvw.dll when trying to open an XSD with the BizTalk editor. He’s on an interim build of BTS06 R2, so bugs are to be expected, but he wasn’t sure what shdocvw was, so he asked me. In case you’re curious, shdocvw is the WebBrowser control.
  • Did I mention that I left my laptop power cord at the office again on Tuesday? That’s three times in four the last five trips to my office (not counting weekends, sick days and training). My boss actually got a spare from his boss that I can leave at the house 24/7.

Binding Across States in WF

I didn’t get much done today – recovering from the norovirus and all. But I did figure out an important point about State Machine Workflows.

For my SSB/WF prototype, I decided to implement my business logic as both as a sequential and state machine workflow. While everything worked fine in my sequential prototype, things started failing once I got to my second state. Turns out that I was trying to bind property values across states, which is a no-no. Since states may be entered more than once, they are executed in their own subordinate activity execution context. As per the State Activity docs, “the definition of the child activity in the activity tree (referred to as the template) is never executed and is always in the Intialized state”.

I’m fairly sure that when you try to property bind across states, you’re connecting to this template activity, rather than the activity that was actually executed. So instead of getting real data (in my case, the handle of a SSB conversation) you get whatever that value was set to in the designer.

Of course, once I figured out about the subordinate AEC, this behavior makes perfect sense. But it could be better documented. So far, the best information on them is in the Advanced Activity Execution chapter of Essential WF.

Activity Property Bind Dialog

BTW, to deal with this, you need to promote the values that matter out of the individual activity instance up into the workflow instance itself. In the databind dialog box, there are two tabs: “Bind to an existing member” and “Bind to a new member”. I’m not sure why the WF dialog existing member tab is there for state machine workflow since it doesn’t do what you might expect it to. Instead, you should create a new member as I’ve done here. This creates a field or dependency property (whichever you choose) on the parent workflow itself, which is then available to all activities in all states within the workflow.

I wonder how this works with XAML only workflows? There doesn’t appear to be any way to declare a field or dependency property in XAML. The templates that ship with the WF SDK aren’t XAML-only, they’re a combination of XAML and code. When you create a new member, it’s always created in code. The idea of XAML only workflows is very appealing – it severely cuts down the surface area that can be meddled with in your host. But you still need to easily share data between activities!

Morning Coffee 17

Yesterday’s Morning Coffee was canceled on account of barfing. For all the gory details (you have been warned), check out my wife’s blog.

  • Only 12 responses to the State of the Union were posted as I write this. Dunno why, but I was expecting more. Maybe this whole Web 2.0 thing is overblown a bit! 😄
  • Speaking of the State of the Union, is it just me, or did anyone else find it odd that the Scooter Libby trial started the same day?
  • AtlasASP.NET AJAX 1.0 is done. Lots more on this from Scott Guthrie’s blog. While I’m not personally that interested in ASP.NET AJAX itself, two things strike me as interesting in this release. First, we’re shipping all the code for this. The client side JavaScript library, the Control Toolkit, even the server-side components. Second, it’s nice to see the Developer Division shipping something this significant without waiting for the next release of Visual Studio. Here’s hoping that both of these two trends continue.
  • Rich McCollister pointed me to the XmlProviderLibrary. Bad on me for not looking harder.
  • Windows Live Writer is pretty cool, but it is missing one feature that I needed twice Tuesday. While embedding images in a post is cake, there doesn’t seem to be a way to embed non-image files. You know, like the ColorConsoleTraceListener Project or the Live Search for Chartity Search Providers. I’m guessing the infrastructure to post images and files would be identical, but there’s no UI interface for it. I checked out the WLW SDK online and found the ISmartContent.Files.Add method, so I’m guessing it’s doable. But there’s no such animal on the Live Gallery. I wonder why nobody else has built this yet? Is this really that unique a request?

DevHawk.ColorConsoleTraceListener

As mentioned this morning, I factored the ColorConsoleTraceListener code into a seperate assembly and added config support. It’s pretty simple, but I find it useful. Let me know if you do too.

Download DevHawk.ColorConsoleTraceListener here.

Quote of the Day

“Having a family member who is in politics, I’ve learned that whenever you see what seems like a religious fundamentalism there usually is a quest for money and/or power behind it.”
-Dare Obasanjo, What is Rob Weir (and IBM’s) Agenda with the OOXML Bashing?