0

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

GregC
  • 7,737
  • 2
  • 53
  • 67
roundcrisis
  • 17,276
  • 14
  • 60
  • 92

1 Answers1

1

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.

porges
  • 30,133
  • 4
  • 83
  • 114