-
Also, is there an option in MetaLama contracts to disable (or remove) expensive contracts from a release version? (i.e. We would like some assertions to be permanent but others, the more computationally expensive ones to only be active when we are developing and testing new features, but disabled or removed in release mode.) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 Specifically: public class Fabric : ProjectFabric
{
public override void AmendProject( IProjectAmender amender )
{
#if RELEASE
amender.SetOptions( new ContractOptions {
ArePreconditionsEnabled = false,
ArePostconditionsEnabled = false,
AreInvariantsEnabled = false } );
#endif
}
} |
Beta Was this translation helpful? Give feedback.
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
andAreInvariantsEnabled
properties of theContractOptions
class. See the reference documentation.Specifically: