RSS

Category Archives: Code Contracts

Must use the rewriter when using Contract.Requires

Recently I began using the new DevLabs: Code Contracts. This is indeed a nice feature to C#. But you may get the error when you call a method that has some contract precondition saying the following:

Description: Must use the rewriter when using Contract.Requires


This error is telling you that the option “Perform Runtime Checking Contract” is unchecked.
Please note that you have to turn on that option not in the code that calls the specific assembly, but the assembly that owns that code.

Assembly with CodeContracts

Option has to be checked

 

Calling Assembly

Option has not necessarily checked

Advertisements
 
Leave a comment

Posted by on May 9, 2011 in Code Contracts

 

Tags: