Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

CCRewrite fails with NRE on async method with Ensures.ForAll with captured params #69

@SergeyTeplyakov

Description

@SergeyTeplyakov

Code contracts repo has a bunch of tests for async methods. Unfortunately, some of them are broken.

For instance, tests for async6.cs to async9.cs will fail because ccrewrite.exe will return -1.

Here is a small repo for the issue:

class TestTaskContracts
{
    public async Task<List<int>> FooAsync(int limit)
    {
        Contract.Ensures(Contract.ForAll(Contract.Result<List<int>>(), i => i < limit));

        await Task.Delay(42);

        return Enumerable.Range(1, 10).ToList();
    }
}

Running ccrewrite on this class will fail with NullReferenceException at System.Compiler.Writer.cs line 1814.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions