Skip to content

CCRewrite unhappy with Toolset Compilers 1.0.0-rc1-20150113-03 #21

@codespare

Description

@codespare

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions