Code Contracts for .NETFree
Code Contracts are static library methods used from any .NET program to specify the code’s behavior. Runtime checking and static checking tools are both provided for taking advantage of contracts.
Sign in to write a review
Hi, CC should work with VS2013 without any problem.
Not working in VS 2013
It's Dec. 12, 2013. I have VS 2008 with Framework 3.5.
Great tools! When will be released version with Visual Studio 2013 RTM full support?
I previously used Code Contracts back in 2010 and 2011 (with Pex). Worked well. Good concept especially linked with Pex (aka Digger). After upgrading to VS2013, I tried to use Code Contracts on a new project, however after installing, it completely crashes VS2013 Premium - everything is broken, all docked windows are showing exception messages. Extensions are failing to load. Eventually VS "stops" according to Windows. The solution is to repair the VS2013 installation. I will not install this again - especially since PEX is not supported in VS2013.
Great concept, decent implementation. It's good enough that I've chosen to standardize my dev team on it; and I haven't seen anything comparable in any other programming environment. The concept is definitely 5 stars, but the implementation is 3 stars IMO:
After a while, one is wondering, how one could write projects without this tool.
Code Contracts doesn't work with Resharper :( Any plans for supporting R#?
I have installed it twice and I keep getting an error saying I need to install CCRewrite. How come?
Absolutely excellent and highly recommended. Getting into the contracts way of things has improved both my productivity and my mental code models enough that I wouldn't code without them, these days.
Does not working with VS 2013 Preview :(
Absolutely excellent. I use code contracts extensively and they have added value in discovering bugs (by being "debug.assert" on steroids, and useful for static analysis), preventing bugs (by making it painless to provide brilliant documentation for you methods and types, so other devs easily know what a method/type supports and what it doesn't), and accelerating the resolution of bugs (with the rewriter turning contracts into assertions, you catch issues usually much closer to where the bug actually occurs, than where it actually starts causing damage -- like where an exception is thrown; also, so often we will know "okay, this bug is because this method doesn't handle the case where p=5 correctly. But we know must read around the code a bit because we've got no idea if this is a bug in the method and it /should/ handle p=5, or it's a bug in the caller which shouldn't ever /pass/ p=5 -- we never ask these questions with methods documented with code contracts).
Excellent tool! I wish more people would know about it.
I love this project. The fact that I can create contracts against an interface saves me code in multiple implementations as well as keeping changes to rules in a single place. This is the best kept secret of the .NET world - more people should use this.
I absolutely love it and warmly recommend it.
Nearly two years back I used it and then I think it was not in the list of extensions. That time I found it quite handy.
It would be nice to see a code example or a link to more information.