none
I just can't get Code Contracts working at all

    Question

  • I thought it was time I tried out Code Contracts, so I installed version 1.4.40602.0 Premium Edition to work with Visual Studio 2010 Ultimate (I'm using Visual C# 2010). Created a new project, but instead of a Code Contracts tab in the project properties I get a blank tab with a message on the right that says "An error occurred trying to load the page.

    Unable to create the designer.  File is already opened in an incompatible editor."
    I don't think it's me (I keep an open mind about these things though). Tried a reboot. Made sure VS wasn't running, uninstalled, reinstalled, same problem. Whats wrong?

    Thanks.

    Wednesday, July 13, 2011 1:22 PM

All replies

  • Hi,

    Where did you download the installer from?  Try this one, if you haven't already:

    http://download.microsoft.com/download/B/2/A/B2AC27BD-B797-402D-A02D-1263FBA157FA/Contracts.devlab9ts.msi

    I got the link from this page, under the download buttons:

    http://msdn.microsoft.com/en-us/devlabs/dd491992

    - Dave


    http://davesexton.com/blog
    Wednesday, July 13, 2011 5:16 PM
  • Hi Dave, sorry for the delayed response and thanks for your reply. I think that's where I got the installer from too, and certainly I've just retried with your link and got the same error message. I guess it may well not be code contracts that's at fault but a more general problem with my installation, but everything else appears to work fine. I wish Microsoft's error message was more specific, but it doesn't say which file is already open or what the 'incompatible editor' is. I've tried rebooting in safe mode to make sure as little as possible is running, but that doesn't help. I wanted to be sure before going through the pain of reinstalling Visual Studio  that it's definitely going to help, it seems a bit drastic.

    Nick

    Friday, July 15, 2011 8:24 AM
  • I think this has something to do with VS 2010 SP 1.
    Wednesday, July 20, 2011 7:31 AM
  • Could be, I certainly have SP1 installed. I haven't noticed any issues apart from Code Contracts not working.


    Nick Brett Software Developer Fugro GRL, Wolverton, UK
    Wednesday, July 20, 2011 8:57 AM
  • I do not think SP1 is the cause. I have Visual Studio 2010 Ultimate with SP1 and Code Contracts premium edition which I downloaded on July 20, 2011. And I can see the code contracts tab on my project properties easily.

    What type of new project did you create?

    And have you tried creating another project or another project type and examining the project properties tab there?

    Also, there is an extension called Code Contracts Editor extensions. I can confirm that the code contracts tab works without that and with that. So that is not, and should not be a factor.

    I recommend you repair your Visual Studio installation on the assumption that it has been corrupted.


    Best Regards, David K Allen http://codecontracts.info Minneapolis, Minnesota, USA
    Saturday, July 23, 2011 2:10 AM
  • I think you're right, a couple of colleagues have SP1 and Code Contract installed without this issue. Unlike me they had Code Contracts installed before installing SP1, but I don't suppose that's much of a clue. I've tried every project type, but in all cases the Code Contracts tab is present but blank and comes up with the same meaningless error message. I expect I'll finish up reinstalling everything, it's frustrating when everything works fine except for Code Contracts, and I was only trying to do an evaluation at the time. If I ever work out what was wrong I'll let you know.

     

    Thanks for your reply,

     

    Nick

     


    Nick Brett Software Developer Fugro GRL, Wolverton, UK
    Monday, July 25, 2011 8:21 AM
  • @TrickyNicky

    I have installed Code Contracts in Visual Studio 2008 SP1 and am seeing a blank tab in project properties with the following error message:

    An error occurred trying to load the page.

    Class not registered.

    Looking for object with CLSID: {1F89CA21-E885-439D-92F5-C36ABE518593}.

     

    I am certainly interested in what you find....

    Tuesday, July 26, 2011 3:54 PM
  • Yes I believe I had an error message like that one too at one stage. I think it was after I tried using Code Contracts in safe more. It was just an idea at the time in case it helped, but it didn't. I wonder if that means that the problems in the two installations are the same. I tried rerunning the SP1 install again but that had no effect. I guess I've already tried reinstalling Code Contracts a few times, so I guess the next thing will be to reinstall Visual Studio. Any guesses as to what my error message "An error occurred trying to load the page. Unable to create the designer.  File is already opened in an incompatible editor." is referring to? I've searched on line and found a few mentions of the message but with no satisfactory answer, although none of them particularly in connection with Code Contracts.

    If I get time today I'll reinstall Visual Studio. I suspect it's a hammer to crack a nut, but it will probably work. I'll let you know if/when I have more news.

    Nick

     


    Nick Brett Software Developer Fugro GRL, Wolverton, UK
    Wednesday, July 27, 2011 8:39 AM
  • You most likely have solved this problem already, but for all others that experience this problem: I solved it by running the installer explicitely as an Administrator.

    The installer does not elevate the installer process to admin rights. So I launched cmd.exe as Administrator and started the setup from there - and it worked. Maybe you have also to "unblock" the file as it is a download from the internet (right click on installer file, select Properties, click on "Unblock" button).

    hth,

    Bernhard

    • Proposed as answer by Bernhard Koenig Tuesday, September 20, 2011 11:34 AM
    Tuesday, September 20, 2011 11:33 AM
  • Which installer do you mean?
    Tuesday, January 31, 2012 10:56 PM