Search code examples
c#.net.net-corecode-contracts

Are code contracts supported in .net core?


In the .net framework there were Code Contracts which allowed me to specify pre/post conditons in my code. Are they supported in .net core/.net 5?


Solution

  • Namespace System.Diagnostics.Contracts is available but project is abandoned.

    Alternative VS2019
    https://softwarerecs.stackexchange.com/questions/47108/the-best-code-contracts-alternative-for-vs-2017-2019-and-net-core-projects

    Discussion about .Net Core

    https://github.com/dotnet/runtime/issues/23869

    Is Code Contracts still the recommended way to go in 2020

    https://github.com/dotnet/docs/issues/17640