views:

325

answers:

2

I have two workflow foundation (.NET 3.5 SP 1) application which compiles fine. It has two declarative rule conditions in it. Both are very simple, examples:
- !this.Shutdown - this.Runtime == null

The project builds correctly without error or warning, however when I run the application it fails with the exception: error 1342: Activity 'whileNotShutdown' validation failed: Can not find the condition "Shutdown not requested".

In the other application I am using a more complex ruleset in policy which generates the following exception: error 1398: Activity 'Defaults' validation failed: Can not find the rule set "Rule Set1". Check if rule set is defined in the rules file.

I have tried removing the .rules file and recreating it by recreating the two rules and that did not help.

The question is: What is wrong that is causing this error?

Some things I have tried:

  • Placing the workflow rules in the larger workflow makes no difference to the issue.
  • The issue is effecting all workflows in the solution now (even those that used to work).
  • Using a code rule condition doesn't have the same problem - the issue is related to the rules file somehow.
  • Rebuilding workflow didn't help
A: 

Declarative workflow rules are not checked by the compiler so there is no help there. When you reference 'this' in rule it means the workflow. So your properties Shutdown and Runtime must be declared at the workflow level. I presume the Runtime refers to the WorkflowRuntime and that is kind of unusual, and not recommended, to have inside of your workflow so there may be a design issue here.

Maurice
I have tried them on the workflow level and the same problem occurs. The runtime is not the workflow runtime but another component in the system.
Robert MacLean
A: 
Robert MacLean