-
Notifications
You must be signed in to change notification settings - Fork 150
CodeContracts not working in VS2017 #476
Comments
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. |
Does that mean CC is dead in 2017? |
Hopefully not, but significant amount of work is required to keep it alive. |
Do you know a timeline? None of my DLL projects will compile. |
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. |
It seems that some people have got it sort of working; see #451 |
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. |
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. |
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... |
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. |
I agree! Lots of code quality missing from .NET Core. |
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. |
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. |
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:
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. |
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 |
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)
Thank you again. |
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... |
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 :( @SergeyTeplyakov |
@MkazemAkhgary as far as I can tell, there is no contracts team any more. Don’t hold your breath. |
thanks for letting me know. I was late to the party but I think it was good feature. @yaakov-h |
Is there any version for Win10 |
OS version is irrelevant... this does work on Win10. |
Does the msi install the tool on VS2017? |
Team, hi This works out of the box in Visual Studio 2017. It is part of the: System.Diagnostics.Contract. See exemple below: |
Without the tooling, that will only ever throw an exception saying you must use the rewriter. |
Is this for real? |
Latest commit March 2017. I'd say this is the case. |
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... |
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.
The text was updated successfully, but these errors were encountered: