I am looking to validate method parameters in my code, in the most elegant fashion possible. Code Contracts don't seem to work in 2015. Does anyone use any alternatives?
They're working on it: https://github.com/Microsoft/CodeContracts/pull/36
If you cannot wait, there are a few things that you can do to fix this: https://github.com/Microsoft/CodeContracts/issues/18
"The contract editor extensions now have a single VSIX package for all of the Visual Studio versions includign VS2015!"
https://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-851f-1ce455f66970
I have installed CodeContracts v.1.10.10126.2-rc1 and it is working (and stable) with Visual Studio 2015.
This version of CodeContracts is the first major community-driven release of the DotNet CodeContracts. This release addresses a lot of pending issues with installer, new IL patterns introduced by Roslyn Csc compiler, etc..
NuGet package is located here: https://www.nuget.org/packages/DotNet.Contracts/1.10.10126.4
Prior to this version of CodeContracts, I had to turn contract checking off so I could get my applications to run in VS2015.
来源:https://stackoverflow.com/questions/29818146/what-is-the-best-alternative-for-code-contracts-in-visual-studio-2015