score:2

Accepted answer

my guess is that one of the methods createset, oftype and asenumerable is declared as an extension method with a this-parameter called "source", and codecontrcts can't prove it is not null. also, don't you need to add a requires clause to specify that _uow is non-null on entry?

createset appears to be the extension method since it doesn't appear in msdn. if the method should never return null, you can enforce this by adding this contract to createset:

contract.ensures(contract.result<t>() != null);

when the codecontracts analyzer sees this rule, it will take it as proof that the input to oftype will not be null, and the warning should go away.


Related Query

More Query from same tag