Question

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
Was it helpful?

Solution 2

Eventually found the cause - it was caused by spaces in the class name, which causes the rules file to have spaces in it, which seems to cause the issue.

For example this will cause the error:

alt text http://img512.imageshack.us/img512/661/clipboard01wdu.png

However this will not:
alt text http://img140.imageshack.us/img140/9366/clipboard02t.png

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top