Line switching in a Workflow Foundation issue

I ran into a very strange problem with WF4: when I use the Switch activity and decide on the value of a string variable, the WFO treats the Switch argument as a string, not a variable name. And so I get the wrong results. Steps to play:

  - create new WF
 - add sequence
 - add Switch of String to the Sequence
 - add a new string variable named, for instance, [testText] and set its default value to "test"
 - set argument of the switch to testText
 - create a case in the switch for "test" string and show msgbox on it
 - create another case, let it be default case which shows another msgbox with "default" text
 - run 
And suddenly here we get a window with the text "default", and not the ones for the case of testText
+6
source share
1 answer

You need to use the test value without quotes. Cases contain a literal meaning, not an expression. And yes, I find it confusing.

+11
source

Source: https://habr.com/ru/post/893867/


All Articles