Skip to content

EnC: Changing the type of foreach iterator around await should be rude edit #82926

@tmat

Description

@tmat
async Task F()
{
    foreach (var x in new[] { 1, 2, 3 })    // change to new[] { 1.0, 2.0, 3.0 }
    {
        await Task.Delay(2000);
        Console.WriteLine(x);
    }
}

The program throws NRE after the change is applied.

The same for any lifted variable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions