Code contracts are here!

Published Tue, Nov 4 2008 23:25

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 Microsoft\Contracts 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:

  1. you cannot use the current version of commercial software (there’s only an academic license – wtf???)
  2. 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…

Filed under: ,

Comments

# Manuel Fahndrich said on Monday, March 09, 2009 9:46 AM

There's now a commercial license available for Code Contracts and many bug fixes. Check out:

msdn.microsoft.com/.../dd491992.aspx

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above:  

Search

This Blog

Tags

Community

Archives

Syndication

Email Notifications

News




  • View Luis Abreu's profile on LinkedIn


    Follow me at Twitter

    My books

    Silverlight 4.0: Curso Completo

    ASP.NET 4.0: Curso Completo

    Portuguese LINQ book cover

    Portuguese ASP.NET 3.5 book cover

    Portuguese ASP.NET AJAX book cover

    Portuguese ASP.NET AJAX book cover