Ok, I know I’ve asked for design by contract on C# and that didn’t made it into C# 4.0. However, I’ve just discovered something even better (especially if you’re a VB programmer): we’re getting support for it on the form of a library and some msbuild tasks that are able to perform static and runtime analyses.
There’s an installation package that should work on VS 2008 but it seems like this framework will be migrating to the mscorlib.dll starting from CLR v4.0. YES!!! So, if like me, you’re still on Vista with VS 2008, just go ahead and download the installation package. Then, you can do two things:
- Read the docs, which are installed on the MicrosoftContracts folder (inside your program files folder);
- Watch the PDC video for a demo of the product
Two things before you start jumping around in pure joy:
- you cannot use the current version of commercial software (there’s only an academic license – wtf???)
- it seems like there’s a bug and whenever you use one of the overloads of the static methods that receive a string, those validations won’t be picked up during the static analysis (I didn’t found anything on the docs about this, so I’m assuming it’s some sort of bug).
I’ve already written some code, so I’ll probably add a couple of posts on this topic on the next days. Stay tuned…