Today I ran into a annoying difference between XOML and code based workflows. In a project I have created a custom activity with a public property. I add this activity to a state workflow and add an IfElseActivity below it. Now I want to use the previously added activity property in the declarative rule condition.
In a code based state workflow I can type “this.myCustomActivity1.TestValue == True” into the rule condition editor. The editor indicates the expression is valid and compiling the project succeeds.
However when I do the same in a XOML with code separation state workflow things work differently. I can still add the custom activity and the IfElseActivity. The first time I try to use the custom activity in the rule condition editor the doesn’t show the this.myCustomActivity1. Adding a condition of true and compiling the project makes this.myCustomActivity1 visible in the rule condition editor. Now I can add “this.myCustomActivity1.TestValue == True” and the rule condition editor indicates everything is correct. However when I compile the project produces errors that the field “myCustomActivity1″ on type “WorkflowConsoleApplication1.Workflow2″ does not exist or is not accessible.
Now this is a bit of a PITA as it means creating a public property for every condition I need to test and there is little sense in creating a public property for a local test [:(]
You can vote for this issue at: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=245819