The package Code Contracts Editor Extensions is a Visual Studio editor extension that provides contract support for programmers as they edit code. This extension supports all versions of Visual Studio from 2010 to 2015 (inclusive). It is part of (and requires) the Code Contracts for .NET project, also available on the gallery. The support consists of the following features:
The tool currently works only for C# projects. It helps you program by showing you relevant preconditions and postconditions for methods in your code. In order for contracts to show up on your own code, you must enable the contract reference assembly building of your projects in the Contract control pane of your project. After the first successful build, contracts should start showing up. The extension shows the different contracts with keywords (“requires”, “ensures”) instead of the method calls that you use when actually writing contracts (“Contract.Requires”, “Contract.Ensures”). It also replaces the method-call encodings for the return value of a method (“Contract.Result<T>”) with the keyword “result” and the encoding for pre-state values (“Contract.OldValue”) with the keyword “old”. There are a set of options under the standard VisualStudio options available to tweak the appearance of contracts.
Support within VS2013 Preview is limited to show contracts on metadata on F12. Intellisense contracts within a VS2013 editor don't show up at the moment. |