It happens all the time, I create a new code activity, build it and drop it in the designer, run and BOOM runtime error. I forgot to set the argument. Even worse, sometimes you might have an activity that because of NULL checks or some other design reason does not throw any error and now you have an activity that does nothing and isn’t immediately apparent.
Wouldn’t it be great if we could have thrown a build error? Well, the Workflow team has given us the answer in the form of the [RequiredAttribute]! Simply add it above the argument you want to validate.
Now you’ll get designer and build time errors if the argument has not been properly set.
It’s a small thing but it’s one more way to ensure you’re not introducing simple errors into your code.
I’ve added it to a sample project on GitHub.