“The project type is not supported by this installation” for Workflow project

Download from ActivityExecutionContext in Workflows

caused  “The project type is not supported by this installation” when opened the solution.
On my machine I have Workflow only for VS 2008, but not for VS 2005, but the download solution was in 2005 format.
I’ve explicitely started VS 2008 and then converted solution from 2005 to 2008. Error disappeared. 
Similar problem with Moral: If you are trying to develop with .NET 3.0 maybe it’s a good idea to check that .NET 3.0 is installed first… described here.
Advertisements

Using of Workflow Dependency properties.

In our Workflow application it was created a lot of  Workflow level Dependency properties that was used  to interchange data between different activities.
    Workflow.PropertyA=  Activity1.PropertyA
    Activity2.PropertyA=Workflow.PropertyA
We believed that is a safe way to avoid concurrency problems. But it was WRONG.
 
Article ActivityExecutionContext in Workflows explains, that Workflow properties as a shared data between activities is not a safe method and can cause concurrency errors in case of CAG or similar usage.
Best solution is to use custom activities Dependency properties and direct binding between activities.
Activity2.PropertyA=  Activity1.PropertyA
 

The primary advantage to dependency properties is that they allow binding of property values to instance data at runtime. For example, you can bind the input property of one activity to an output property of another. The actual property values resulting from the binding is determined at runtime. Dependency properties are required when you want to bind properties from one activity to another. However, if you are binding an activity property to a workflow property, the workflow property is not required to be a dependency property. In this case, a normal C# property on the workflow class works fine.

Performance Characteristics of Windows Workflow Foundation tells to avoid using dependency properties if not necessary:
A dependency property is a powerful mechanism that helps you expose activity properties so they can be bound and shared within a workflow instance. There is a small performance overhead associated with this property type, especially when many dependency properties are being accessed from the workflow, but in most cases the overhead should be minimal.
 
Related links: DependencyProperty Class
           wdp snippet

LongestCommonPrefix function for 2 strings

The function that finds  Common Prefix for 2 strings
//converted from http://stackoverflow.com/questions/1250514/find-length-of-initial-segment-matching-mask-on-arrays
             public static string LongestCommonPrefix(string str1, string str2)
             {  
                 int minLen = Math.Min(str1.Length, str2.Length);
                 for (int i = 0; i < minLen; i++) 
                 {
                     if (str1[i] != str2[i])
                     { 
                         return str1.Substring( 0, i);     
                     }
                 }
                 return str1.Substring( 0, minLen);
             }