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.

Blake Helms

Blake Helms is a .NET Software Development Manager for EBSCO Industries, a global company with businesses in a range of industries including Information Services, Publishing and Digital Media, Outdoor Products, Real Estate, Manufacturing and Distribution, and Business Services, headquartered in Birmingham, Alabama.

There he is responsible for several core business applications and has been a driver for software craftsmanship and creating a culture that promotes mentorship and continuous improvement.

He is also the cofounder of the Birmingham .NET Meetup with a mission to promote good development practices and .NET technologies in the Birmingham, Alabama area.

Blake is incredibly passionate about technology in all areas from writing code for work, to audio/video production for his church to automating his home.