Code Contracts for .NET

Free

Code Contracts are static library methods used from any .NET program to specify the code’s behavior. Runtime checking and static checking tools are both provided for taking advantage of contracts.

(79) Review
Visual Studio
2015, 2013, 2012, 2010
Download (179,750)
7/27/2015
1.9.10714.2
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (79)
Sign in to write a review
Sort by:

by Wilhelm.Medetz | May 18 2016

by SD Smith TFL | May 05 2016

by terasato | March 07 2016

Hi hahnl,
I encountered the same issue and found this issue on GitHub.
https://github.com/Microsoft/CodeContracts/pull/166

According to this post, this issue will be fixed in the next version.

by zhongping.xu | December 23 2015

It's a bug happened when you've installed vs in some place other than default location. This version of vsix haven't make the extension.vsixmanifest right.


open file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\CodeContracts\1.9.10714.2\extension.vsixmanifest
in notepad, change the <Identity Version="" to right version.

File info like below:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Version="1.9.10714.2" Id="CodeContractsVSIX.MicrosoftResearch.990ACB05-1AAE-4fa6-A178-9BF28206012F" Language="en" Publisher="Microsoft Research" />
<DisplayName>Code Contracts Tools</DisplayName>
...
</Metadata>
...
<Assets />
</PackageManifest>

by hahnl | December 21 2015

Warnings and messages from static contract checking don't appear in the VS2015 error list

by Judith79 | November 25 2015

I run the MSI to install Code Contract for .NET but during the install the installation will fail.
The messsage shown on the screen is "'Extensions' is not a valid short file name." in the log file

MSI (s) (F0:8C) [11:11:10:657]: Product: Microsoft Code Contracts (devlabs_TS) 1.7.11202.10 for .NET -- Error 1325. 'Extensions' is not a valid short file name.

Error 1325. 'Extensions' is not a valid short file name.

The installation is busy with checking the free space, when the error occures.

There is enough free space on the hdd.

Does anybody know a solution for this?

by CrazyCurlyBlue | November 22 2015

Same as reported by Andez. VS 2015 Community edition keeps reporting an error with Code Contracts. Are there any plans to fix this in the near future?

by An Dr | November 16 2015

Current package seems to have a problem with Visual Studio 2015. VS does not start after this package is installed. The splash screen comes up and then it goes away and the process is gone. The error received is 'No InprocServer32 registered for package [Async Query Service Package]'. A repair install of VS is required to fix.

by Michael-Chen | November 05 2015

UPDATED
It is a perfect tool in speaking of function. However, I also have the same problem that although 1.9.10714.2 is installed (on Visual Studio 2015). VS still tell me it needs to be updated from version 1.8.

I found following steps would work around.

1. After install the extension, open and close VS.

3.Within following 4 folders
1.C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\CodeContracts\1.9.10714.2
2. C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\CodeContracts\1.9.10714.2
3.C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\CodeContracts\1.9.10714.2
4.C:\VS10Root\Common7\IDE\Extensions\Microsoft\CodeContracts\1.9.10714.2

4. There is one file named extension.vsixmanifest in each of above 4 directory. Open it with notepad.

5. make sure in each of three file, on line 4, the value of Identity version is 1.9.10714.2. If not, change it to 1.9.10714 and save the change.

6. Restart VS two times, first time it still tell you to upgrade, but second time and afterwards it's OK.

by Casperlet | October 17 2015

The installation of version 1.9.10714.2 is completed. But it still shows the version 1.8.10107.10 in VS2015. Either uninstall or disable button is grey. How to uninstall it?

THX

by keith.ndb | October 16 2015

I love the idea of code contracts. In theory.

In reality, this extension is very buggy. It has gotten worse over the past year with false positive warnings. It is now almost impractical to use it.

by Patrick Smacchia [NDepend] | October 07 2015

Many users are complaining about several bugs, including a wrong version numbers and some bugs that prevent to use "Emit contracts into XML doc file" in VS2015, and more than two months after the last release v1.9.10714.2 we still get no fix?

Disappointing!
https://github.com/Microsoft/CodeContracts/issues/226


by Zakhar Amirov | October 07 2015

Static analyzer is not working stable in VS2015.
Uninstall does not work properly. Extensions stays in the VS 2015 Extensions list.
After unable to uninstall addon properly VS 2015 freezes on Debug and requires full reinstall.

by Andez | September 18 2015

I really do like Code Contracts.

But in VS2015, I keep getting an error reported and I will keep sending the same error reports until it gets fixed!!

And yes, please sort that annoying version.

So it is a 4 from me.

by lostmsu | September 18 2015

Great extension! Especially if will stop to incorrectly annoy about outdated version

by Atle Smelvær | September 07 2015

Please fix the version information so the plugin does not show up for updates after you have updated. After installing 1.9 the Extensions window still thinks I'm running 1.8.... (happens on all VS installations)

by nodots | September 04 2015

The version workaround works on VS 2015 but VS 2013 still claims it's using the previously installed version. Any ideas?

by KubuS_ | August 18 2015

the version workaround by Michael-Chen works.

CC Guys, please pay attention to those version bugs - it happened in the past too. CodeContracts as a tool are awesome!

by Gil Yoder | August 15 2015

The version problem is due to old version information within the extension manifest files within the package. After installing, I modified the version field for Visual Studio 2015 to fix the problem on my machine.

by PeterDefendo | August 03 2015

Installed version 1.9, but Visual studio 2013 still says its using 1.7..

1 - 20 of 79 Items