Ok, I have the following:
[Pure]
public override string NodeName
{
get
{
return "#comment";
}
}
All my contracts are proven by the static checker. However, when I change it to this:
[Pure]
public override string NodeName
{
get
{
Contract.Ensures(Contract.Result<string>() == "#comment");
return "#comment";
}
}
I get other (apparently unrelated) contracts failing. The point of failure is the 'return' line.
The contracts in question are on the superclass of this, in an invariant:
[ContractInvariantMethod]
protected new void ObjectInvariant()
{
Contract.Invariant(dataField != null);
Contract.Invariant(TextContent == dataField); // fails
Contract.Invariant(NodeValue == dataField); // fails
Contract.Invariant(Data == dataField);
}
Is this a bug in Contracts, or am I doing something wrong?
I can supply full source if that will help.