Code Contracts announcement
-
Link
It has taken a long time, we know, but we have finally released the contract editor extensions for VS2012 and an update to VS2010.
The new version is much more stable and less CPU consuming than previously and hopefully much more useful as a result.
For VS2012: http://visualstudiogallery.msdn.microsoft.com/02de7066-b6ca-42b3-8b3c-2562c7fa024f
For VS2010: http://visualstudiogallery.msdn.microsoft.com/85f0aa38-a8a8-4811-8b86-e7f0b8d8c71b
If you haven't tried it yet, then please do and let us know what you think!
To review, the extensions should show you method contracts in the following situations:
- While you are typing a call to a method: the signature helper window should show you each overload's contract in the same window as the signature and exception information.
- Hovering over an existing method call: the quick info window should show you the method's contract in addition to its summary information.
- Method override and interface implementation definitions: hover over the method name in the signature to see the tooltip of the contracts inherited (or defined in the method).
- Metadata windows: if you "go to definition" for a type/method that is defined in an external assembly then the metadata window that VS creates should be augmented with method contracts.
Enjoy.
-
Link
Release 1.5.60502.11 is now live!
A new release of Code Contracts is now live on the VS Gallery.
The release notes have been updated.
Please keep using the forum for communicating with us.
The VS editor extensions have also been updated on the gallery.
-
Link
We 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. -
Link
We have added a section to our web site listing the external projects that we know about which are using Code Contracts. If you would like your project listed, please send us a link and we'll add it to the list. This would really help us in our efforts to get the project more fully supported by the product groups.
Thanks!
Mike
-
Sticky0VotesAnyone going to BUILD?
I will be there, giving a demo. If you want to chat a little bit, about CodeContracts, etc. just look for me (or just send me an email to ...
-
Answered0VotesCodeContracts: requires unproven: Enum.IsDefined(typeof (OperationStatusEnum), status)
For the following I get the messages: warning : CodeContracts: requires unproven: ... -
Unanswered0VotesNUnit, Team City and Code Contracts
I have a set of unit tests running against methods that have a bunch of Contract.Requires<T> and Contract.Ensures statements in them. These run fine in Visual ... -
Answered0VotesNew suggestions show up in Baseline.xml.new, but not Visual Studio Message List
I have a project. I check the Baseline checkbox, and build the project. Baseline.xml is created. This suppresses all suggestions from the Static Checker as ... -
Proposed0VotesPossible bug?
0); Contract.Ensures(size > 0); size = size - 1; } } Do you have any ... -
Unanswered0VotesCan not find ContractInvariantMethodAttribute in Fakes.dll
Hi, I'm getting build warnings when using Fakes with CodeContracts C:\Program Files (x86)\Microsoft Visual Studio ... -
Unanswered0VotesCode Coverage on the last precondition
Assemblies rewritten by the current release (1.5.60502.11) show partial code coverage (displayed as peach colored) on the last precondition. All other preconditions are fully ... -
Discussion0VotesAnyone going to BUILD?
I will be there, giving a demo. If you want to chat a little bit, about CodeContracts, etc. just look for me (or just send me an email to ... -
Unanswered1Votes[BUG - REGRESSION] Cannot see locals in the debugger in methods that contain a yield statement
We can again not see locals in the debugger when debugging methods that contain a yield statement. This was fixed (and I verified that) in version 1.4.60221.11 (Feb 22, ... -
Unanswered0VotesRewrite aborted due metadata errors
In our SharePoint Project we have reference to Microsoft.Office.Server.Search.dll and it ... -
Unanswered0VotesProblem highlighting CodeCoverage when using CodeContracts
We are using VS2012 Update 1 + CodeContracts 1.4.60317.12. When having a CodeContractClassFor(InterfaceType) defined in the same file as the Interface, for ... -
Unanswered0Votes"Failed to connect to any cache" in 1.5.60502.11
After installing the new version the caching seemed to be working fine for a while. Searching my dev folders I could find a lot of cccheck1.5.60502*.mdf and cccheck1.5.60409*.mdf files, so I assume it ... -
Answered0VotesCannot implement IList<T> and IReadOnlyList<T> simultaneously
A single container class cannot implement both interfaces simultaneously: IList<T> and IReadOnlyList<T>. warning CC1035: Method ... -
Unanswered0VotesAdditional contracts on System.Reflection.CustomAttributeExtensions
Would it be possible to add additional requires and ensures contracts to the members of System.Reflection.CustomAttributeExtensions. Specifically ensures that verify the ... -
Unanswered0Votesccrewrite fails with "Index was outside the bounds of the array"
Hi, I migrated to VS2012 and when I did the CodeContracts tab was missing when I opened the solution. I updated CodeContracts to the latest version (1.5.60502.11) ... -
Answered0Votesccrewrite and ccecheck crash due to StackOverflowException
I am running code contracts (with and without enabling runtime checking) on a project and I get the following errors: A. with runtime checking ... -
Answered13VotesIs Code Contracts dead?
Sorry about the sensationalist title, but my intent is to be a bit blunt and try to elicit some response from the dev team on this. Wake up guys! The situation: After waiting for ... -
Proposed0VotesCan you elaborate what AssumeInvariant actually does ?
Hello, I read the user documentation about new AssumeInvariant. But the doc is somewhat limited and I am a bit puzzled about what it does. As far as I know as invariants we declare boolean ... -
Answered2VotesDebugging async methods impossible when rewriter is enabled
If I enable the code contracts rewriter, then I'm unable to debug async methods. I should note that I'm on the latest version, 1.4.50910 in VS 2012. Here's a simple repro: ... -
Unanswered0VotesCode Contracts 1.5.60502.11 generates unexpected error CC1011: This/Me cannot be used in Requires of a constructor
We have the following code: private static readonly Slot[] EmptyList = new ... -
Unanswered1VotesMicrosoft Fakes vs. class with invariant
Microsoft Fakes framework is unable to generate a fake for a rewritten class that contains object invariant. It tries to compile a C# source containing method named $InvariantMethod$, which is ... - Items 1 to 20 of 1866 Next ›


