Skip to content

Null warnings not reported for iterator methods #23701

@cston

Description

@cston

yield return null; should generate warning: cannot convert null to non-nullable reference:

using System.Collections.Generic;
class C
{
    static IEnumerable<object> F()
    {
        yield return null;
    }
    static IEnumerable<T> G<T>() where T : class
    {
        yield return null;
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions