internal class Program
{
static void Main(string[] args)
{
var t = new CustomClass();
}
private sealed class CustomClass : IEnumerable
{
public IEnumerator GetEnumerator()
{
return new CustomEnumerator();
}
}
private sealed class CustomEnumerator : IEnumerator
{
public object Current => throw new NotImplementedException();
public bool MoveNext()
{
throw new NotImplementedException();
}
public void Reset()
{
throw new NotImplementedException();
}
}
}

Npgsql implements that interface for NpgsqlDataReader (because NpgsqlDataReader inherits from DbDataReader, inheriting IEnumerable). Our implementation of GetEnumerator returns System.Data.Common.DbEnumerator, which touches quite a bit of IDataReader methods, and some of them are not AOT friendly (mostly related to size).