Category Archives: Workflow

Back in the Office

One year later, I’m back from sabbatical and in my office (which has been moved to building 18). It’s a bit surreal to be back, though fun to be catching up on the past year of developments and reconnecting with our plans for WF and WCF. I’m looking forward to reengaging with our customers as well. More soon….

Threading in WF 4

A number of customers have asked about the threading model used for WF 4. In brief, our extensibility for threading in the WF Runtime is based on System.Threading.SynchronizationContext.

When a execution is kicked off (indirectly through ActivityRuntime.Run), we will first call SynchronizationContext.OperationStarted(). Next we will call SynchronizationContext.Post() to get on a “workflow” thread.

We will then execute any pending work items from our internal scheduler queue. It is possible that more work items will be scheduled (through context.ResumeBookmark, context.ScheduleActivity or activity completion). In that case, we will continue to execute those work items as well. Execution will remain on the “workflow thread” until we either go idle (no more work items), or the runtime is explicitly paused by the host through ActivityRuntime.RequestPause (which is what’s called underneath Unload() for example). When this happens, we will call SynchronizationContext.OperationCompleted().

How you configure a SynchronizationContext depends on the host construct that you are using.

  1. For WorkflowServiceHost, we will use the the value of SynchronizationContext.Current at the time of workflowServiceHost.Open (unless UseSynchronizationContext is set to false). This is consistent with the rest of WCF.
  2. WorkflowInvoker.Invoke/BeginInvoke has overloads where you can explicitly provide a SynchronizationContext for us to use
  3. WorkflowInvoker.InvokeAsync will use the value of SynchronizationContext.Current for consistency with the Whidbey async pattern
  4. WorkflowInstance has a constructor overload which allows you to explicitly provide a SynchronizationContext for us to use

If no SynchronizationContext is provided by the host, we will use an internal WF default SynchronizationContext. The WF default SynchronizationContext uses IO completion ports under the hood to implement Post().

Setting up SQL Persistence for WF4 Beta 1

A few customers have hit a speed bump when trying to setup persistence with WF4 Beta1. We have multiple sql scripts included (for 3.5 persistence and 4.0 persistence). The problem is that depending on your WF application model in Beta1 you have to execute different scripts (we’ve fixed this in Beta2).

For WorkflowServiceHost usage, use these SQL scripts:

  • C:WindowsMicrosoft.NETFrameworkv4.0.20408SQLenSqlPersistenceProviderSchema40.sql
  • C:WindowsMicrosoft.NETFrameworkv4.0.20408SQLenSqlPersistenceProviderLogic40.sql

For WorkflowInstance usage, use these SQL scripts (note the lack of “40”):

  • C:WindowsMicrosoft.NETFrameworkv4.0.20408SQLenSqlPersistenceProviderSchema.sql
  • C:WindowsMicrosoft.NETFrameworkv4.0.20408SQLenSqlPersistenceProviderLogic.sql

Also make sure that the connection string in your application matches the database you created.

Ramping back up on the technical blog posts

I’ve been pretty quiet recently on the technical blog front, mostly because my work was in the dark depths of development. A few weeks ago, we released Beta 1 of Visual Studio 2010 which includes all of the technologies I’ve been working on for the past 3 years 🙂

One of the big components included in .Net 4.0 Beta1 is the WF4 framework that I unveiled at PDC. The team is blogging here, and I’ll be including ongoing tidbits for WF and WCF to help smooth out speed bumps encountered by our customers.

Writing custom languages

I’m sitting in one of the coolest talks at PDC. ChrisAn & GioDL are showing how you can use the nascent "Oslo" language technologies to write your own textual language. MGrammar has been described as yacc on crack.

You should check it out (probably starting tomorrow) at:

UPDATE: You can download the SDK here and start playing with writing your own custom language. Fun stuff!

WF 4.0: A First Look

On Monday afternoon I unveiled WF 4.0 at PDC 2008. With this public disclosure you will start seeing a lot more details of the WF system here.

For those of you that were able to attend my session in person, please fill out the evaluation form (we’re currently at about 5% participation).

For those that couldn’t join me in person, the session was videotaped and is available at Enjoy!

WCF talks at PDC

Matt posted a great description of the WCF (and WF) talks we’re giving at PDC.

In particular there are two sessions that I’d like to call out.

The first is Ed Pinto’s session, where you’ll find out about the significant investments we’ve made to improve the WCF authoring experience:

WCF 4.0: Building WCF Services with WF in Microsoft .NET 4.0.

Eliminate the tradeoff between ease of service authoring and performant, scalable services. Hear about significant enhancements in Windows Communication Foundation (WCF) 4.0 and Windows Workflow Foundation (WF) 4.0 to deal with the ever increasing complexity of communication. Learn how to use WCF to correlate messages to service instances using transport, context, and application payloads. See how the new WF messaging activities enable the modeling of rich protocols. Learn how WCF provides a default host for workflows exposing features such as distributed compensation and discovery. See how service definition in XAML completes the union of WF and WCF with a unified authoring experience that simplifies configuration and is fully integrated with IIS activation and deployment.

Once you’ve built your services, you will need to deploy, host, and manage them.  Windows Server "Dublin" handles this complexity, and Dan Eshner will unveil the details here:

Hosting Workflows and Services

Hear about extensions being made to Windows Server to provide a feature-rich middle-tier execution and deployment environment for Windows Workflow Foundation (WF) and Windows Communication Foundation (WCF) applications. Learn about the architecture of this new extension, how it works, how to take advantage of it, and the features it provides that simplify deployment, management, and troubleshooting of workflows and services.