I m having a ensures unproven: !ReferenceEquals(Contract.Result<T>(), null)
that contract is on an interface I have no control of
my implementation is something like this
public Guid Blah()
{
var guid =开发者_开发百科 Guid.NewGuid();
if(ReferenceEquals(guid, null))
{
throw new ApplicationException("This shoul");
}
return guid;
}
I tired with contract assumes instead of the if and some variations of the code above, but still getting the warning, any ideas? Cheers
Seems like this is an interaction with the generic types. If you fix the type to Guid
it works fine... I think this is a bug in Code Contracts, so I've filed a question on the Code Contracts forum.
精彩评论