Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

CodeContracts not working in VS2017 #476

Open

Description

This extension does not work in VS2017 RC. Most of my projects will not compile since I use this for all of my DLL assemblies.

Activity

  1. SergeyTeplyakov commented on Jan 5, 2017

    @SergeyTeplyakov
    Contributor

    Unfortunately, Roslyn compiler changed a lot of codegen and to add support for VS2017 reasonable amount of changes is required for all 3 projects: CCI, ccrewrite and cccheck.

  2. RealDotNetDave commented on Jan 5, 2017

    @RealDotNetDave
    Author

    Does that mean CC is dead in 2017?

  3. SergeyTeplyakov commented on Jan 5, 2017

    @SergeyTeplyakov
    Contributor

    Hopefully not, but significant amount of work is required to keep it alive.

  4. RealDotNetDave commented on Jan 5, 2017

    @RealDotNetDave
    Author

    Do you know a timeline? None of my DLL projects will compile.

  5. chrisaut commented on Jan 6, 2017

    @chrisaut

    I have the same issue, I bet on CC for some largish projects.

    As much as I love it and will miss it, I think everyone should seriously consider getting them out of their code base sooner rather than later. There is just not enough commitment there from either MS or the volunteers here (I don't blame them, it was always made clear that it's a non supported technology).

    I can only hope that the idea of CC will live on, there are proposals to bake contracts into C# and the runtime proper.

  6. ContentsMayVary commented on Jan 9, 2017

    @ContentsMayVary

    It seems that some people have got it sort of working; see #451

  7. tom-englert commented on Jan 10, 2017

    @tom-englert
    Contributor

    It worked for me, but I have tried only with VS2015 compatible sources; from the comments above it seems to break as soon as you use any new VS2017 compiler feature.

  8. manison commented on Jan 10, 2017

    @manison

    It is my understanding that one of the issues is support for the new PDB format. I believe this can be worked around by switching back to the old format (setting Debug Type from Portable to Full or PdbOnly).

    Is there a list of tasks that needs to be done to support VS2017? Anything up for grabs? We're also relying on CC heavily.

  9. wischi-chr commented on Feb 25, 2017

    @wischi-chr

    Very sad that such a great concept will die this way. Removed CC from most of my projects today and switched back to if throw guards. Will miss Interface Contracts though...

  10. ContentsMayVary commented on Feb 28, 2017

    @ContentsMayVary

    Well we've just gone through the process of converting all our code contracts to use a simple contracts replacement class that we wrote. No support for interface contracts, of course. Such a shame.

  11. RealDotNetDave commented on Mar 13, 2017

    @RealDotNetDave
    Author

    I agree! Lots of code quality missing from .NET Core.

  12. lesonkorenac commented on Jun 29, 2017

    @lesonkorenac

    Would it be possible to create release of version, that is working on Visual Studio 2017? From what I've learned here, there is sort of working version available (#451).

    Or at least post somewhere compiled binaries.

    I have problems compiling it myself, since I could not find any detailed tutorial. There seems to be a lot of prerequisites, that are not mentioned anywhere.

  13. yaakov-h commented on Jun 29, 2017

    @yaakov-h
    Contributor

    You can get the base functionality by building from master. Just run buildcc as outlined in the readme, from the Developer Command Prompt for VS2013.

  14. lesonkorenac commented on Jul 3, 2017

    @lesonkorenac

    I managed to build Code Contracts from master few month ago, after figuring out some error messages (like that I need to install tools for building C++ in Visual Studio) and adding some references to projects in solution.

    Sadly, version that I managed to build does not work on new machine and now I've used Visual Studio 2017 instead of Visual Studio 2015 for building Code Contracts and I have another set of errors. And after few hours of solving the errors I've got stuck on this:

    "c:\PathTo\CodeContracts\Microsoft.Research\ManagedContract.Setup\buildMSI10.xml" (All target) (1) -> "c:\PathTo\CodeContracts\CodeContracts.sln" (Clean;Rebuild target) (2) -> "c:\PathTo\CodeContracts\Microsoft.Research\ManagedContract.Setup\CCRefGenAttributes\CCRefGenAttributes.csproj" (Rebuild target) (70:2) -> (ContractDeclarativeAssemblyCS target) -> C:\Program Files (x86)\Microsoft\Contracts\Languages\CSharp\ContractDeclarativeAssemblyAttribute.cs(14,6): error CS0246: The type or namespace name 'ContractVerificationAttribute' could not be found (are you missing a using directive or an assembly reference?) [c:\Users\janpe\Development\C#\CodeContracts\Microsoft.Research\ManagedContract.Setup\CCRefGenAttributes\CCRefGenAttributes.csproj] C:\Program Files (x86)\Microsoft\Contracts\Languages\CSharp\ContractDeclarativeAssemblyAttribute.cs(14,6): error CS0246: The type or namespace name 'ContractVerification' could not be found (are you missing a using directive or an assembly reference?) [c:\Users\janpe\Development\C#\CodeContracts\Microsoft.Research\ManagedContract.Setup\CCRefGenAttributes\CCRefGenAttributes.csproj]

    I is very annoying, that there is no release of Code Contracts for Visual Studio 2017. And even more so, that I'm not able to build it on my own.

    As I read through issues here and on Stack Overflow, developers are abandoning Code Contracts because there is no version available for Visual Studio 2017 and soon I may be one of them.

    I don't want to blame someone, that I'm not able to use it. I just want to say that it would be helpful for me and other developers to have access to compiled binaries of current version.

  15. yaakov-h commented on Jul 4, 2017

    @yaakov-h
    Contributor

    lesonkorenac

    now I've used Visual Studio 2017 instead of Visual Studio 2015 for building Code Contracts and I have another set of errors

    Use Visual Studio 2013. This is the only version that is actually supported as a build environment for Code Contracts.

    You can download the AppVeyor build artifacts for master at https://ci.appveyor.com/project/SergeyTeplyakov/codecontracts/build/1.10.10311.145/artifacts

    If you'd rather a NuGet package, I've uploaded a copy of the build I use here: https://github.com/WiseTechGlobal/CodeContracts/releases/tag/wtg%2Frel%2Fv1.10.20308.4

  16. lesonkorenac commented on Jul 5, 2017

    @lesonkorenac

    Thank you. It helped a lot.

    I did not know that Visual Studio 2013 is the only supported version (I've added this information on wiki).

    I would also recommend to modify README.md, since instructions for building are incomplete (there is no mention about Visual Studio 2013 or Developer Command Prompt)

    For working on the project, open CodeContracts.sln and build.

    To create the installer and the nuget package, just run buildCC .

    Thank you again.

  17. AbbottWC commented on Aug 4, 2017

    @AbbottWC

    This is less than ideal. I'd already moved my projects from VS 2015 to VS 2017 when this gem popped up. Again. I'm glad I came upon this, and that VS2015 is still able to open projects that have been modified in VS 2017, because I'm gutting this from my code right now and not looking back...

  18. MkazemAkhgary commented on Nov 23, 2017

    @MkazemAkhgary

    Hopefully not, but significant amount of work is required to keep it alive.

    will contract team start to rework code contracts to adopt with latest? I started to use code contracts (unaware of this issue) in my UWP projects. now I have to rollback everything :( Sergey Teplyakov (@SergeyTeplyakov)

  19. yaakov-h commented on Nov 23, 2017

    @yaakov-h
    Contributor

    Mohammad kazem Akhgari (@MkazemAkhgary) as far as I can tell, there is no contracts team any more. Don’t hold your breath.

  20. MkazemAkhgary commented on Nov 24, 2017

    @MkazemAkhgary

    thanks for letting me know. I was late to the party but I think it was good feature. Yaakov (@yaakov-h)

  21. MartinEgli commented on Feb 9, 2018

    @MartinEgli

    Is there any version for Win10

  22. yaakov-h commented on Feb 10, 2018

    @yaakov-h
    Contributor

    OS version is irrelevant... this does work on Win10.

  23. MartinEgli commented on Feb 10, 2018

    @MartinEgli

    Does the msi install the tool on VS2017?

  24. Mzangwe commented on Apr 24, 2018

    @Mzangwe

    Team, hi

    This works out of the box in Visual Studio 2017. It is part of the: System.Diagnostics.Contract.

    See exemple below:
    Contract.Requires<ArgumentNullException>(amount > 0, "Amount to deposit must be positive.");

  25. yaakov-h commented on Apr 24, 2018

    @yaakov-h
    Contributor

    Without the tooling, that will only ever throw an exception saying you must use the rewriter.

  26. alexagranov7 commented on Feb 7, 2019

    @alexagranov7

    Mohammad kazem Akhgari (@MkazemAkhgary) as far as I can tell, there is no contracts team any more. Don’t hold your breath.

    Is this for real?

  27. adimosh commented on Feb 7, 2019

    @adimosh

    Mohammad kazem Akhgari (@MkazemAkhgary) as far as I can tell, there is no contracts team any more. Don’t hold your breath.

    Is this for real?

    Latest commit March 2017. I'd say this is the case.

  28. yaakov-h commented on Feb 7, 2019

    @yaakov-h
    Contributor

    That's just a merge commit. The most recent commit with content, authored by somebody at Microsoft, was May 2016.

    Also, the last lead developer from Contracts left Microsoft Research for Facebook about a week after this repo was published...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions