Skip to content

How easy is it to replace MS CodeContracts with MetaLama contracts? #348

Closed Answered by gfraiteur
Orcomp asked this question in Q&A
Discussion options

You must be logged in to vote

There is no upgrade path from Microsoft Code Contracts, so I guess it will be manual work.

You can disable precondition, postcondition and invariant checking using the ArePreconditionsEnabled , ArePostconditionsEnabled and AreInvariantsEnabled properties of the ContractOptions class. See the reference documentation.

Specifically:

public class Fabric : ProjectFabric
{
    public override void AmendProject( IProjectAmender amender )
    {
#if RELEASE
        amender.SetOptions( new ContractOptions {
         ArePreconditionsEnabled = false,
         ArePostconditionsEnabled = false,  
         AreInvariantsEnabled = false  } );
#endif
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Orcomp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants