Code Contracts
Discuss and provide feedback on Code Contracts.
Announcements
Release 1.2.21023.14 is now available!
Mike BarnettMSFTSaturday, October 24, 2009 9:07 PMA new release of Code Contracts is now live. And we almost made our once-a-month release schedule! This is mostly a release that fixes a lot of problems reported on the forum. Check out the release notes for the details.
Please keep using the forum to let us know how you're using Code Contracts and what problems you're running into. Of course, we'd be thrilled to hear of any success stories too.
And we'll be at PDC 2009! We'll be having a session along with Pex and also a demo booth. If you're going to PDC (and of course you should), please come by and see us.Welcome to Code Contracts for .NET
Mike BarnettMSFTFriday, February 20, 2009 2:28 AMWe are so happy that you are interested in Code Contracts! You are at exactly the right place for learning how to use contracts from any .NET language to:
- Specify method preconditions for expressing conditions that a caller must meet in order to call a method.
- Specify method postconditions for expressing conditions that the implementation of a method must meet before returning. Conditions can be specified for both normal termination as well as exceptional termination.
- Specify object invariants that describe the healthy states for an instance of a class.
We currently provide three tools for making use of contracts:
- A binary rewriter that operates as a post-build step to inject the contracts into the appropriate places for them to be evaluated at runtime.
- A static checker that operates as a post-build step to analyze your code without even executing it for potential contract violations.
- A documentation generator that adds information about the contracts to the XML documentation files for your project.
The installer for these tools is available for either commercial or non-commercial use.
We welcome you to use the forum to ask questions about how to use contracts and the tools, to make suggestions for how we can improve, and --- if you really must --- to report bugs and problems.
You can also check out our home page at Microsoft Research.
Filtering and SortingUse these options to narrow down the question and discussion list.
- 145

CodeContracts XML docs not getting generated
Manuel FahndrichMSFTThursday, November 05, 2009 9:55 PM - 10253

Release 1.2.21023.14 is now available!
Mike BarnettMSFTSaturday, October 24, 2009 9:10 PM - 13102

Get started using contracts!
Mike BarnettMSFTFriday, February 20, 2009 2:37 AM - 02852

Frequently Asked Questions
Manuel FahndrichMSFTWednesday, February 25, 2009 6:33 AM - 015

Adding ensures causes other contracts to fail
Porges 6 hours 21 minutes ago - 180

What version of 2010
Mike Barry Friday, November 06, 2009 8:39 PM - 018

Precondition failed: offset + count < buffer.Length for Stream.Read method
VBA Derks 13 hours 16 minutes ago - 376

What are the best practices to unit test expected code contract failures in debug and release builds.
VBA Derks Wednesday, November 04, 2009 9:19 PM - 261

Explicitly declared state modification
Alexey R. Thursday, November 05, 2009 7:21 AM - 2295

Unexpected BadImageFormatException in a GroupBy poscondition using CodeContract in VS2010 Beta1
miguel katrib Friday, October 09, 2009 4:52 AM - 1116

Framework 'Contains' method is declared as Impure
David K Allen Sunday, November 01, 2009 6:05 PM - 4157

Invariants on interface contracts
Jon Skeet Monday, November 02, 2009 9:37 PM - 148

Out parameter of a pure method
Alexey R. Wednesday, November 04, 2009 6:39 PM - 4139

Sandcastle BuildAssembler.exe hangs when enabling Code Contract XML documenation
VBA Derks Wednesday, October 21, 2009 6:33 PM - 2474

(temporary) Implicit PureAttribute for methods whose names start with Is / Can / Has?
winSharp93 Monday, July 13, 2009 4:45 PM - 034

Contract class for a static class
Alexey R. Wednesday, November 04, 2009 12:40 PM - 4177

Much increased VS Startup time
winSharp93 Saturday, October 24, 2009 8:53 PM - 049

What is the purpose of ContractPublicPropertyName attribute?
Alexey R. Tuesday, November 03, 2009 8:19 AM - 4153

Contract Request: System.IO.Stream
Strilanc Thursday, October 22, 2009 10:48 PM - 332362

Team System only?
CommonGenius.com Tuesday, February 24, 2009 4:38 AM


