Code Contracts Editor Extensions VS2010

Microsoft DevLabs Free

Displays Code Contracts (when editing C#) in code, Intellisense, and in metadata files. Inheritance: Displays contract information on methods with inherited contract information, or on interface/abstract methods Metadata: Displays contract information in metadata files. Qui...

(12) Review
Visual Studio
2010
Download (33,496)
8/14/2013
1.5.60813.10
View
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (12)
Q and A (27)
Sign in to write a review
Sort by:

by ajj3085 | December 01 2012

Works wonderfully! Except for some crashing, this is a must have if you're doing Code Contracts.

by Matt Burton | February 01 2012

Great extension! I especially like the adornments for inherited contracts; a very nice addition.

The IntelliSense output is clobbered by ReSharper unless ReSharper's IntelliSense is disabled. That's unfortunate, but it's no fault of this extension.

EDIT [Possible Bug]: It seems that when defining contracts on an interface method that takes a reference to an interface in the Microsoft.Office.Interop.* namespace as a parameter, the extension does not show adornments for implementing types, nor does the hover text reflect the contract. See [http://social.msdn.microsoft.com/Forums/en-US/codecontracts/thread/dda8fd5a-7a6d-44cb-bea9-dd11549acb61] and [http://stackoverflow.com/questions/9102059/issue-with-code-contracts-on-generic-interface].

by net12345 | January 09 2012

In solution with 48 projects (C# and C++) compilation is not possible any more when the "Code Contracts Editor Extensions" is installed. VS2010 Professional (4.0.30319) hangs (CPU 100%, a lot MSBuild processes are spawned) while compiling the first C++ project. Disabling the extension doesn't help, only uninstalling it. It's a pity, because I like to see the code contract information in the tool tips.

by Morten Mertner | May 25 2011

This could eventually turn out to be a great extension, but I have several major grievances with it:
- It's very slow, so contracts do not appear right when you open a file. It affects basic stuff like typing in editor windows by slowing them down - sometimes the added lag is so bad you can see characters appear way after you typed them (and this is on a modern PC).
- The way contracts are displayed consumes too much horizontal space for my taste. It would be better if they appeared collapsed somewhere and only displayed on mouse-over, which may also allow for snappier operation as it wouldn't have to get all contracts at once.
- There are various annoying visual glitches in the current release.
I'll be keeping my eyes on future releases for now it's a pass from me.

by amweiss | May 06 2011

by jcdickinson | December 21 2010

Great plugin. Keeps me from having to do the good ol' F12 to see what the contracts are.

by David K Allen | November 01 2010

When it works, it's very cool. Many times, it just does not work.
And it slows down other operations, so I disabled it at work as I need high speed. But this is a great first release. I will keep it on at home for training and small stuff.

by Robert Haken | November 01 2010

by Daryl Zuniga | September 25 2010

by Mike Barnett | September 18 2010

by Francesco Logozzo - personal | September 18 2010

by Peli | September 10 2010

Sign in to start a discussion


  • Installation error: Path too long?
    3 Posts | Last post July 02, 2013
    • When I try to install this extension, I get an installation error (PathTooLongException).
      The following is taken from the install log:
      
      
      10-09-2010 11:23:12 - Beginning to install extension to Microsoft Visual Studio 2010 Ultimate...
      10-09-2010 11:23:13 - Install Error : System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
         at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.BeginInstall(IInstallableExtension installableExtension, Boolean perMachine, AsyncOperation asyncOp)
         at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallWorker(IInstallableExtension extension, Boolean perMachine, AsyncOperation asyncOp)
      
    • It should be installing into C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft Research\Code Contracts Editor Extensions\1.4.30903.0. At least on my machine that is where it goes to. For my username ("mbarnett") that works out to 135 characters. Does it give you any indication of where it is trying to install to? 
    • Hello,
      
      Passing the /admin (/a) key to VSIXInstaller.exe solved it for me.
      
      So the command line should look like this:
      VSIXInstaller.exe /a ContractAdornments10.vsix
      Once installed, the extension appears under
      C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Research\Code Contracts Editor Extensions VS2010\1.5.64024.12
  • Install Error : System.IO.PathTooLongException
    2 Posts | Last post July 02, 2013
    • 3/21/2011 2:11:57 AM - 	Name            : Code Contracts Editor Extensions
      3/21/2011 2:11:57 AM - 	Author          : Microsoft Research
      3/21/2011 2:11:57 AM - 	Version         : 1.4.31130.0
      3/21/2011 2:11:57 AM - 	Description     : Displays Code Contracts (when editing C#) in code, Intellisense, and in metadata files.
      
      ...
      
      3/21/2011 2:12:01 AM - 	Microsoft Visual Studio 2010 Ultimate
      3/21/2011 2:12:01 AM - 
      3/21/2011 2:12:01 AM - Beginning to install extension to Microsoft Visual Studio 2010 Ultimate...
      3/21/2011 2:12:01 AM - Install Error : System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
         at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.BeginInstall(IInstallableExtension installableExtension, Boolean perMachine, AsyncOperation asyncOp)
         at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallWorker(IInstallableExtension extension, Boolean perMachine, AsyncOperation asyncOp)
      
    • Hello,
      
      Passing the /admin (/a) key to VSIXInstaller.exe solved it for me.
      
      So the command line should look like this:
      VSIXInstaller.exe /a ContractAdornments10.vsix
      Once installed, the extension appears under
      C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Research\Code Contracts Editor Extensions VS2010\1.5.64024.12
  • Support for International OS environments
    3 Posts | Last post July 02, 2013
    • I tried to install the extensions on Windows XP Professional German but i get an 
      
      Install Error : System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
    • I'm having the same problem here. Any solution please?
    • Hello,
      
      Passing the /admin (/a) key to VSIXInstaller.exe solved it for me.
      
      So the command line should look like this:
      VSIXInstaller.exe /a ContractAdornments10.vsix
      Once installed, the extension appears under
      C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Research\Code Contracts Editor Extensions VS2010\1.5.64024.12
  • .net 3.5
    1 Posts | Last post May 27, 2013
    • It seems it doesn't work for 3.5 projects, but I cannot google this problem. Am I missing something?
  • Update for Visual Studio 2012
    6 Posts | Last post March 19, 2013
    • Can we expect an update for Visual Studio 2012? If so, is there any timeframe?
    • I'm also really hoping for an update... 
    • Would be real nice to have this available for VS2012 sometime soon.
    • Bump.  How is it that Code Contracts are all over the Framework itself, but there's no word on a 2012 update?!?!
    • There seemed to be no such topic at connect so I've added one: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3330248-provide-code-constracts-editor-extension-for-vs201
      
      Please vote!
    • Thanks to Manuel, the extensions are now available for VS2012:
      
      http://visualstudiogallery.msdn.microsoft.com/02de7066-b6ca-42b3-8b3c-2562c7fa024f
  • The SPYke
    1 Posts | Last post June 04, 2012
    • I use GlobalAssemblyInfo.cs in my projects and the extension can't get assembly identity. So I have no intellisense on my contracts. 
      
      Output:
      Getting the assembly identity for project...
      Couldn't gather suffecient information from the project to construct an assembly identity.
      A proper assembly identity could not be constructed, unable to reload assembly.
      Assembly identity for the project: ... was null.
      Failed to build assembly reference for: ...
      Failed to get CCI reference for: ...
      
      If I move assembly version from Global to AssemblyInfo.cs, then it works. Latest version of the Code Contract library and of the extension, VS 2010 Pro. Is there any way to fix it?
  • Update for VS 11 Beta (or RTM)?
    1 Posts | Last post May 22, 2012
    • Can we expect an update for Visual Studio 11 Beta (or RTM)? If so, is there any timeframe?
      
  • Constructors
    1 Posts | Last post May 06, 2012
    • The extension works great, but I'm not getting intellisense support for constructors at all.  Example of what I'm talking about follows.  I have intellisense support on foo's go method, but not on the constructor.
      
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Diagnostics.Contracts;
      
      namespace CodeContractsTest
      {
          class Program
          {
              static void Main(string[] args)
              {
                  ConsoleWriter Foo = new ConsoleWriter("Bob");
                  Foo.Go();
      
                  Console.ReadLine();
              }
          }
      
          public class ConsoleWriter
          {
              string _text;
      
              public ConsoleWriter(string text)
              {
                  Contract.Requires(text != null, "null isn't allowed!");
                  _text = text;
              }
      
              public void Go()
              {
                  Contract.Ensures(_text != null, "text can't be null!");
                  Console.WriteLine(_text);
                  _text = null;
              }
      
              [ContractInvariantMethod]
              void ObjectInvariant() {
                  Contract.Invariant(_text != null);
              }
          }
      }
  • Update for Visual Studio 11?
    1 Posts | Last post March 02, 2012
    • Can we expect an update for Visual Studio 11 Beta (or RTM)? If so, is there any timeframe?
  • Adornments for interface methods when using Office Interop
    1 Posts | Last post February 01, 2012
    • When I define a contract on an interface method that takes a reference to a type in Microsoft.Office.Interop.* as a parameter, adornments are not displayed on the interface definition or implementing types, and the hover text does not reflect the contract.  Replacing the interop type with some other reference type resolves the issue.
      
      Code Contracts DevLab Forum post: [http://social.msdn.microsoft.com/Forums/en-US/codecontracts/thread/dda8fd5a-7a6d-44cb-bea9-dd11549acb61]
      
      StackOverflow Post: [http://stackoverflow.com/questions/9102059/issue-with-code-contracts-on-generic-interface]
      
      Still a great extension!
1 - 10 of 27 Items