Here are the basic implementation details that you should know about the design time expression editing experience in the WF designer.
An expression is bound to an activity argument or property. In the designer, the expressions are displayed inside of an ExpressionTextBox control. You can enter one single expression per ExpressionTextBox. Statements are not supported. The lack of statement support means that if you need to declare variables, you must declare them in the Variable designer.
Inside of Visual Studio, there are two components you need to be aware of – the hostable editor and the hosted compiler. The hostable editor is a slimmed down version of the big VB IDE, complete with its own compiler. The hostable editor provides a full-fledged IDE experience, including IntelliSense, syntax highlighting, squiggles, pretty listing, parameter information, etc. It is totally separate and independent of the hosted compiler. It is also not available for use in a rehosted workflow designer.
The hosted compiler is used by the WF runtime to validate your expressions. The compiler is invoked by the validation service, and also in the background when you edit your expressions. When the hosted compiler determines that there is an error in your expression, there is a red error icon that shows next to the expression in the designer and the error message appears at the error list. The hosted compiler performs validation both at design time and at runtime.
The compiler inside the hostable editor is actually different from the hosted compiler. Both of these compilers are actually different than the regular VB compiler you find in the big VB IDE. (Why we have so many compilers is a story better not told.) There are no interesting differences between the hostable editor and hosted compiler in terms of compilation features. However, there are some significant differences between the hostable editor/compiler and the big VB compiler that you should keep in mind, here they are: