The following code gives me the warning Contract class 'FooContracts' should be an abstract class
. From all the examples I've read online (e.g. http://www.infoq.com/articles/code-contracts-csharp), this should work (presumably without compiler warnings).
[ContractClass(typeof(FooContracts))]
public interface IFoo {
void Bar(string foo);
}
[ContractClassFor(typeof(IFoo))]
internal sealed class FooContracts : IFoo {
void IFoo.Bar(string foo) {
Contract.Requires(foo != null);
}
}
I'm in Visual Studio 2010, with the following settings in the Code Contracts
section of the project's properties:
- Perform Runtime Contract Checking (set to
Full
) - Perform Static Contract Checking (under
Static Checking
) - Check in Background
I also defined the CONTRACTS_FULL
compilation symbol to make ReSharper shut up.
Am I missing something to make this compile without warnings?