-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
After upgrading from to Microsoft.Net.ToolsetCompilers.1.0.0-beta2-20141216-04, CodeContract ccrewrite.exe (latest, v1.7.11202.10) starts to fail during build with:
error CC1099: Contract extraction failed: Found field <>8__1 in contract that shouldn't be here: In method ns.type.member.
Exact same code had no issue with Microsoft.Net.ToolsetCompilers.1.0.0-beta2-20141223-03.
Function exhibiting error is in a static class, along the lines of:
public static IEnumerable<tuple<object, MemberInfo, LinkArity, int, LinkDirection, object, LinkOutput>> BreadthFirstTraversal(
object fromObject,
Func<object, IEnumerable<Tuple<MemberInfo, LinkArity>>> getSubjectRelations,
Func<object, MemberInfo, LinkArity, IEnumerable<Tuple<int, object, LinkOutput>>> getRelatedObjects,
IEqualityComparer<object> nodeComparer = null
)
{
Contract.Requires<ArgumentNullException>(getSubjectRelations != null);
Contract.Requires<ArgumentNullException>(getRelatedObjects != null);
...
so with only 2 simple preconditions. Function body uses yield return after that.
Commenting out the contracts removes the build error.
This only occurs in a few instances overall, the majority of contracts are unaffected, but I haven't identified the exact pattern causing that issue yet.
In another instance, ccrewrite goes through, but runtime behavior becomes faulty with a precondition asserting systematically.