General Rules Changes from .NET Framework 3.0 to .NET Framework 3.5

Some rules functionality has changed between .NET Framework 3.0 and .NET Framework 3.5. The following list details these changes:

  • In a rule action, when stating a nullable type is greater than a null, in the rules engine in .NET Framework 3.0 that comparison always evaluates to true. In .NET Framework 3.5, this evaluates to false, which is the same behavior as in C#. To work around this issue in .NET Framework 3.0, you must do a custom check for null before comparing nullable types with any value.

  • Custom conditions tell the rules engine at design time what type the conditions will be returning at run time. In .NET Framework 3.0, custom conditions are allowed to return a different type at run time than what was specified at design time. In .NET Framework 3.5, this scenario would fail.

  • In .NET Framework 3.0, concatenating string and char data types together would produce an erroneous result. For example, if you concatenated the string "s" with the char 'c', the resulting concatenation would be "s43." In .NET Framework 3.5, the result of the concatenation is "sc." To get the correct behavior in .NET Framework 3.0, cast any char data types to string before concatenation.

  • In .NET Framework 3.0, comparisons between two nullable bool data types using logical operators such as | and & will return null if either bool is set to null. This behavior is different from the behavior defined in the C# specification. In .NET Framework 3.5, the comparison behavior between two Boolean values now matches the behavior defined in the C# 3.0 specification. To get the correct behavior in .NET Framework 3.0, you must perform a custom check for nullable bool data types. If you are reusing C# code within your rules definitions, you must change the C# code to accommodate the behavioral differences between C# and WF rules.

  • In .NET Framework 3.0, you do not have access to an ActivityExecutionContext object from within a custom rule condition; however, in .NET Framework 3.5, you do.

See Also

Other Resources

Rule Changes in .NET Framework 3.5