I have a piece of code that looks something like this:
public TReturn SubRegion(TParam foo) { Contract.Requires(foo!= null); Contract.Ensures(Contract.Result<TReturn>() != null); if (!CheckStuff(foo)) foo.Blah(); return OtherStuff(foo); }
CC gives me a warning:
Warning 301 CodeContracts: Consider adding the postcondition Contract.Ensures (Contract.Result ()! = Null); to provide additional documentation to library customers
This is obviously completely redundant! I have several such redundant warnings, and this becomes a problem (real warnings burrow into the stream of redundant offers).
I have two questions:
1) Is there something missing that means it's not a bad recommendation? In this case, what do I need to do to fix this warning?
2) Alternatively, if this is just a CCCheck quirk and cannot be fixed, how can I hide or suppress this warning?
Nb Just in case, if you think that my example is missing something important, the complete code is the SubRegion method here .
source share