Code Contracts
Discuss and provide feedback on Code Contracts.
Ankündigungen
Welcome to Code Contracts for .NET
Mike BarnettMicrosoft EmployeeFreitag, 20. Februar 2009 02: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.External projects using Code Contracts?
Mike BarnettMicrosoft EmployeeDonnerstag, 22. März 2012 17:09We 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
New Release for Visual Studio Editor Extensions for C# (v1.4.40602.0)
Mike BarnettMicrosoft EmployeeSamstag, 4. Juni 2011 00:14There is a new release of the VS 2010 editor extensions on the VS Gallery. The extensions themselves haven't changed, but the underlying infrastructure has had many contract-related improvements so I hope it performs better. I will try to get around to fixing the performance problems that everyone has been noticing.
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: a small graphic should pop up above the method definition showing any inherited contracts.
- 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.
Documentation is available at the MSR Code Contracts site.
Release 1.4.50327.0 is now live! (Includes Dev11 support -- see note below)
Mike BarnettMicrosoft EmployeeDonnerstag, 29. März 2012 01:28A new release of Code Contracts is now live. Besides some small bug fixes, this release provides support for Dev11. NOTE: In order to see the Code Contracts pane in Dev 11, you must manually run "devenv /setup" from a command prompt (either a Visual Studio command prompt or else one that has a path set so "devenv.exe" (for Dev11) is found).
If the download links have the usual caching problem, then you can try these:
Download CodeContracts
Please keep using the forum for communicating with us. We are trying to make the case for Code Contracts to be included in Visual Studio as an official product. Please send us your feedback as soon as possible, especially if you have any details about how exactly it has helped your development process.
Dev11 support
Mike BarnettMicrosoft EmployeeDonnerstag, 1. März 2012 17:44In order to see the Code Contracts pane in Dev11, you must run "devenv /setup" from a command prompt after installing the tools.
If you have any problems, please let us know!
Filtern und SortierenMit dieser Optionen können Sie die Diskussionsliste eingrenzen.
- 64451

Possibly unboxing a null reference - Nullables
Dave Sexton Montag, 15. März 2010 03:00 - 11615892

Missing Contracts on Libraries
Manuel FahndrichMicrosoft EmployeeDienstag, 10. März 2009 06:20 - 1272

Problem with naming my own project *.Contracts.dll
Rolf de Vries Donnerstag, 10. Mai 2012 21:28 - 63579

Cannot extract contracts from rewritten assembly
sterioma Dienstag, 29. Dezember 2009 12:17 - 5748

Code Contacts June 2011 -> Mazrch 2012 SLOWER
Zubin Appoo Donnerstag, 19. April 2012 06:12 - 62219

[bug] Invalid contract for Buffer.BlockCopy
Ilya Margolin Donnerstag, 18. August 2011 08:38 - 1235

Static checker uncaught exception
p.roman Montag, 7. Mai 2012 12:14 - 0416

Need VS 11 (Beta) Editor Extensions or VS 2012
Frank Dzaebel Donnerstag, 3. Mai 2012 09:02 - 0313

Custom Contract Assembly No Longer Working
Dave Sexton Mittwoch, 2. Mai 2012 15:47 - 0295

windows8 beta installation problem
Asoke Bhattacharyya Mittwoch, 2. Mai 2012 14:29 - 82382

What is the future of code contracts?
wilhelm.medetz Mittwoch, 21. September 2011 14:29 - 3300

Do codeContract only throw exceptions?
devBrix Mittwoch, 2. Mai 2012 05:54 - 5388

Can extra options be specified via an environment variable?
gallóglaigh Montag, 23. April 2012 19:15 - 8961

Code Contracts and VS 11 Beta - 'StanPackage' did not load correctly error
wilhelm.medetz Freitag, 30. März 2012 07:10 - 2519

Bug report: ccdocgen crash
Stephen Cleary Dienstag, 10. April 2012 14:23 - 42373

Unhandled Exception [v1.4.40602.0]
Andrey Titov Dienstag, 19. Juli 2011 16:04 - 2567

Latest code contracts 1.4.50126.1 memory usage
Simbel Montag, 5. März 2012 18:07 - 2406

Wrong Suggested requires: Contract.Requires(System.Linq.Enumerable.Count(data) > 0);
maxsur Montag, 16. April 2012 05:28 - 41102

Caching and CachesqlServer
Chris Cornacchia Dienstag, 24. Januar 2012 17:52 - 2692

[BUG] invalid messages from static checker
Dluk Donnerstag, 5. April 2012 15:38

