Source code for the CodeContracts tools for .NET
C# C++ Visual Basic C XSLT TeX
Latest commit a7df47a Dec 11, 2016 @SergeyTeplyakov SergeyTeplyakov committed on GitHub Merge pull request #459 from WiseTechGlobal/wtg/pr/rsp-generation
Add flag to generate cccheck RSP at build time
Permalink
Failed to load latest commit information.
.nuget Update to NuGet 2.8.6 Aug 18, 2015
Common Fix all remaining line endings Sep 1, 2015
Demo Fix all remaining line endings Sep 1, 2015
Documentation Fix all remaining line endings Sep 1, 2015
ExperimentalTools Fix all remaining line endings Sep 1, 2015
Foxtrot Merge remote-tracking branch 'microsoft/master' into internal/master Sep 22, 2016
Microsoft.Research Merge pull request #459 from WiseTechGlobal/wtg/pr/rsp-generation Dec 12, 2016
Microsoft.VisualStudio.CodeTools Removed build ouptut from source control repository. Jan 8, 2016
System.Compiler Merge pull request #452 from mnkraus/FixAssemblyRefs Jul 26, 2016
.gitattributes Add initial .gitattributes Jun 14, 2015
.gitignore Removed build ouptut from source control repository. Jan 8, 2016
CCR.sln Initial checkin Jan 6, 2015
CONTRIBUTING.md Add 'contract issue' to the list of labels. Jun 24, 2015
CodeContracts.sln Maintainability: Remove experimental projects and related tests: Dec 31, 2015
CodeContracts10.vsmdi Initial checkin Jan 6, 2015
FoxtrotTestRun.testrunconfig Fix for unit tests Jun 25, 2015
LICENSE.txt Re-save all text files with proper line endings Jun 14, 2015
Local.testsettings Initial checkin Jan 6, 2015
README.md Improved formatting of "provided tools" list in README. Mar 24, 2016
TraceAndTestImpact.testsettings Re-save all text files with proper line endings Jun 14, 2015
appveyor.yml Enable foxtrot tests Feb 5, 2016
build.bat Propagating build script error codes all the way to the top level scr… Aug 2, 2015
buildCC.bat Making sure to restore packages from the top-level solution before bu… Aug 2, 2015
oob.sln Initial checkin Jan 6, 2015

README.md

CodeContracts

Join the chat at https://gitter.im/Microsoft/CodeContracts

Source code for the CodeContracts tools for .NET

Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs.

The contracts take the form of pre-conditions, post-conditions, and object invariants. Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation. Code Contracts bring the advantages of design-by-contract programming to all .NET programming languages. We currently provide three tools:

  1. Runtime Checking. Our binary rewriter modifies a program by injecting the contracts, which are checked as part of program execution. Rewritten programs improve testability: each contract acts as an oracle, giving a test run a pass/fail indication. Automatic testing tools, such as Pex, take advantage of contracts to generate more meaningful unit tests by filtering out meaningless test arguments that don't satisfy the pre-conditions.
  2. Static Checking. Our static checker can decide if there are any contract violations without even running the program! It checks for implicit contracts, such as null dereferences and array bounds, as well as the explicit contracts.
  3. Documentation Generation. Our documentation generator augments existing XML doc files with contract information. There are also new style sheets that can be used with Sandcastle so that the generated documentation pages have contract sections.

Quick Links

Building from source

For working on the project, open CodeContracts.sln and build.

To create the installer and the nuget package, just run buildCC <version>.

We use the convention:

  • CC major version = 1.9.1
  • CC minor version = {month}{day}.{buildInTheDay}

For instance, the 10th build on July 16 would be run as follows:

buildCC 1.9.10716.10