Skip to content

Analyze captured variables at the location lambda is converted to a delegate #29617

@cston

Description

@cston
using System;

class C
{
    static T F<T>(Func<T> f)
    {
        throw null;
    }

    static void G(object? o)
    {
        F(() => o).ToString(); // warning: maybe null
        if (o == null) return;
        F(() => o).ToString(); // no warning
    }
}

See LDM-2018-06-04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions