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.

CC1099: Contract extraction failed: async/iterator issue in async without await #172

@mgaffigan

Description

@mgaffigan

I am getting the error CC1099 on a particular method. I have narrowed the method down to one specific change which will cause the failure. The below sample compiled as a console application with rewriting enabled seems to reliably fail.

Error:

EXEC : error CC1099: Contract extraction failed: async/iterator issue: In method EmptyAsyncTest.Program.Foo, assembly EmptyAsyncTest\EmptyAsyncTest\obj\Debug\EmptyAsyncTest.exe

Code:

using System;
using System.Threading.Tasks;

namespace EmptyAsyncTest
{
    class Program
    {
        static void Main(string[] args)
        {
        }

        async Task Foo()
        {
            if (DateTime.Now.Day == 0 && 1 == 2)
            {
            }
        }
    }
}

The following variations do not trigger the bug:

  • Removing async and returning Task.FromResult(false)
  • Removing && 1 == 2
  • Removing DateTime.Now.Day == 0
  • Adding await Task.Delay(1)

Environment:
VS 2015 CTP, Code Contracts 1.9.10714.2, Windows 8.1, Project is .Net 4.5, Only rewriting is enabled
Also repro'd by compiling fe3bf15 and running foxtrot. Same output.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions