-
Notifications
You must be signed in to change notification settings - Fork 150
CodeContracts fail with CONTRATS_FULL reference in ASP.net vNext #231
Comments
Same result when using CodeContracts in an ASP.NET 5 web application. I've installed the CodeContracts NuGet package for the project, but there is no Code Contracts tab in the project properties window. Is there any magic strings I should put in project.json or the .xproj file to make this work? The problem is, I moved a lot of files from a class library (that was using CodeContracts) to the ASP.NET project, so finding and deleting all Contract.Requires lines would be tremendous work, not to mention that I do want to use CC. |
+1 @SergeyTeplyakov, can you please let us know if there are plans to add support to CC runtime checkingfor project.json-based builds? This could probably be done with a post-build DNX command. With all the effort going into DNX and project.json it's important to know whether CC will be compatible... |
@roji It sound like a very good feature in general. If someone has experience with this stuff and can implemnet, I would be happy. My only concern, that DNX and project.json should work on CoreCLR and I have no idea how CC will play there. |
@SergeyTeplyakov, I think there are several things here:
We should probably have two different issues for these. |
+1 |
Any update on this? I'd really need code contracts in dnx packages/asp.net 5 web projects |
I'd love to know more about this also. Thank you |
I would be very happy if some one will pick this task and will start investigating it. Currently, I do have tons of stuff in ccrewrite world, and, unfortunately, don't have time to work on this one:( |
Is there any further update on this? Can code contracts be used in asp.net core 1.0? |
I'll start investigating this issue. Maybe to get full support new .NET CLI tools should be aware of Code Contracts... |
Any news on that topic? I use code contracts all the time and would really miss to not having them in Asp.Net Core. |
I'm joining the crowd. CodeContracts are widely used across our projects. And now, when it comes to migrate some of this projects to .NET Core, lack of CC causes many pain. |
@michaelvolz, @thtp I do understand the value of this proposal, but unfortunately, I don't know what to suggest:). Because this is a community project the only way to fix issue is to start working on it. I can suspect that porting CC to CoreCLR is doable task but it will require significant amount of work. So let's form a group of people who will work on it, decompose it and start hacking! :) |
Hi guys, are you planning to implement this? I love CC and I would like to use it in core projects. However displaying message when an exception from contracts is thrown is really annoying. Tkanks! |
@SergeyTeplyakov if you are serious about it, I am in. |
Is there any progress for supporting netcore apps? |
Would be nice at least to define a strategy for transition. |
Anyone know why code-contracts aren't in common use? |
It was an academic/research project, never a mainstream solution. |
Still no progress? |
@yaakov-h Well - the CodeContracts project was always declared as a Microsoft Research project, but |
@hangy The namespace was originally shipped as a separate assembly. IIRC, it was included in .NET Framework 4.0 with the expectation that Code Contracts would graduate from DevLabs and become a part of the core developer tools. Considering that this had not happened by the time .NET Standard came into being, this really should have set off alarm bells. |
AFAIK the contracts namespace was included in netstandard mainly to preserve compatibility, i.e. so that programs with code contracts code would compile (even if contracts aren't enforced). That doesn't imply any sort of support or a bright future for code contracts. |
@roji that was a strange definition of compatibility. |
@pi3k14 I think saying that you "can't trust .NET Core/Standard assemblies" is a bit of an exaggeration... True, there are a few, well-known dead APIs which have been silently "disabled", but what's the alternative? Throw an exception and break all projects using these APIs? This at least provides an easy transition path to .NET Core/Standard, until you migrate away from Code Contracts, which again, is no longer supported. I do agree it's unfortunate that Microsoft chose to implement Code Contracts - which was always a research project and never matured to an officially-supported product - in such a public, well-known namespace (System.Diagnostics), and that it was included in .NET Framework itself (but nuget wasn't really that widely-used back then). |
|
Related comment: dotnet/runtime#23869 (comment). |
I made a little project (ASP.net vNext DLL Template) with a test project. The test project uses xunit and xunit.runners.dnx. Running the test will fail on Contact.Requires(a != null) with a hint to
CONTRACTS_FULL
being set somewhere.How can Code contracts be used in new ASP.NET Projects?
Can they be used at all? Or are contracts now "deprecated"?
The text was updated successfully, but these errors were encountered: