Code Contracts
Discuss and provide feedback on Code Contracts.
公告
Release 1.2.21023.14 is now available!
Mike BarnettMSFTSaturday, 24 October, 2009 21:07A 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, 20 February, 2009 2:28We 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.
篩選及排序使用這些選項可縮小討論清單。
- 2246

CodeContracts XML docs not getting generated
Manuel FahndrichMSFTThursday, 5 November, 2009 21:55 - 10487

Release 1.2.21023.14 is now available!
Mike BarnettMSFTSaturday, 24 October, 2009 21:10 - 13400

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

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

Why inferring methodensures doesn't work here?
Alexey R. 25 分鐘前 - 4112

False Positive: CodeContracts: Suggested precondition: Contract.Requires(!string.IsNullOrEmpty(value));
Jonathan Allen Saturday, 21 November, 2009 7:53 - 3183

ContractsRuntime recursion guard optimization
Alexey R. Sunday, 15 November, 2009 12:20 - 225

False positive on LinkedList.First
Jonathan Allen 16 小時 35 分鐘前 - 118

False Positive on read-only fields
Jonathan Allen 16 小時 42 分鐘前 - 017

Installer path issue
Kit 10 小時 3 分鐘前 - 129

Unclear Warning "CodeContracts: requires unproven"
Jonathan Allen 16 小時 22 分鐘前 - 230

Automatic Non Null Invariant for Initialized readonly Field in C#
Dave Sexton 23 小時 41 分鐘前 - 020

Inferring invariants
Alexey R. Tuesday, 24 November, 2009 19:53 - 166

Possible bug?
Jahn Otto Næsgaard Andersen Monday, 23 November, 2009 14:18 - 026

Is it fixed in latest release about 'Call to impure method in a pure region in method'
DaveChan Tuesday, 24 November, 2009 12:45 - 148

Is the contract for stream.read incorrect?
John Melville Monday, 23 November, 2009 5:14 - 017

BinaryFormatter Deserialize Missing Ensures Return Not Null
Dave Sexton Tuesday, 24 November, 2009 11:03 - 022

Contract.ForAll Static Checking
Dave Sexton Tuesday, 24 November, 2009 10:53 - 123

Suggested precondition for null check ignores existing precondition for String.IsNullOrWhiteSpace
Dave Sexton Tuesday, 24 November, 2009 10:21 - 1107

Missing Requires in indexer of ReadOnlyCollection<T>
Alexey R. Wednesday, 18 November, 2009 18:43

