Preview of Code Contract Tools Now Available

We’ve mentioned Code Contracts over on the BCL Blog a few times now, but never yet on the CLR Blog.  Basically, Code Contracts are a way to add preconditions, post-conditions, and object invariants to your code.  The goal is to help you catch developer errors earlier in the cycle.  In my Introduction to Code Contracts post, I gave an overview of what had been included in the .NET Framework 4.0 CTP.  I also mentioned that the tools to enable runtime checking and static analysis were not included in the .NET Framework 4.0 CTP.

On Monday, we released a preview version of the Code Contracts tools on the DevLabs site.  DevLabs is a site for getting preview releases of innovative new projects for developers out to the community.  You can read more about it on Soma’s introductory blog post.  The specific Code Contracts page on DevLabs can be found here.

The tools include a binary rewriter to enable runtime checking, a static checker, a new project pane for VS projects, and an updated copy of the Code Contract library that was shipped in the aforementioned CTP.  For more details on what these are, you can check out the Code Contracts page, which includes an overview, a video on how to get started, an FAQ, and other useful information.  You can also check out the documentation (PDF), or get an overview in Soma’s recent post on Code Contracts.

This current release is targeted at Visual Studio 2008 Team System and can be used for commercial development.  The academic release that can be used for non-commercial use on any Visual Studio 2008 edition except Express can still be found on the  Contracts page on the Microsoft Research site.

This release also comes with more ways to provide feedback and get answers.  In my introductory post on the BCL Blog, I mentioned the Code Contracts thread on the Pex forum.  Now Code Contracts has its own forum.  So please go try out these new tools and tell us what you think.

Thanks,
Melitta Andersen
Program Manager, CLR