Code Contracts in Mono
.net, code-contracts, mono, monodevelop
Solution
It's not implemented, so the only thing to make this work would be for you to write the implementation. Mono is an open source project, always happy to take new contributions.
Problem
The following code: ``` Contract.Requires<ArgumentException>(command != null, Resources.Messages.CommandNotSpecified); ``` calls ``` Contract.AssertMustUseRewriter (ContractFailureKind kind, System.String message) ``` which seems to be caused by not configuring Code Contracts to use runtime contract checking, if you were using Visual Studio. the article @ http://devjourney.com/blog/code-contracts-part-2-preconditions/ implies that the code produced without runtime checking configured is: ``` public static void Requires<TException>(bool condition) where TException: Exception { AssertMustUseRewriter(ContractFailureKind.Precondition, "Requires<TException>"); } ``` Does anybody know what to do in MonoDevelop so that the contract works as expected? The exact exception I'm getting is: ``` 2012-11-13 23:33:24.815 StickX[339:c07] mvx: Diagnostic: 34.46 Exception masked NotImplementedException: The requested feature is not implemented. at System.Environment.FailFast (System.String message) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Environment.cs:821 at System.Diagnostics.Contracts.Contract.AssertMustUseRewriter (ContractFailureKind kind, System.String message) [0x00011] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Diagnostics.Contracts/Contract.cs:83 at System.Diagnostics.Contracts.Contract.Requires[ArgumentException] (Boolean condition, System.String userMessage) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Diagnostics.Contracts/Contract.cs:271 ```