title: AutoMapper ProjectTo() can't construct protobuf RepeatedField<> property
body: <p>I have an gRPC application with EF core as ORM. AutoMapper's ProjectTo method is used to construct DTOs. But I get error when constructing collection properties. I prepared the following example:</p>
  <p>Database entities:</p>
  <pre><code>public sealed class Horse
  {
      public Guid Id { get; init; }
      public ICollection&lt;Workout&gt; Workouts { get; } = new HashSet&lt;Workout&gt;();
  }
  public sealed class Workout
  {
      public Guid Id { get; init; }
  }
  </code></pre>
  <p>Context:</p>
  <pre><code>public sealed class MyDbContext : DbContext
  {
      public MyDbContext(DbContextOptions&lt;MyDbContext&gt; options) : base(options) { }
      public DbSet&lt;Horse&gt; Horse { get; private init; } = null!;
  }
  </code></pre>
  <p>DTOs:</p>
  <pre><code>public sealed class HorseDto
  {
      public Guid Id { get; init; }
      public RepeatedField&lt;WorkoutDto&gt; Workouts { get; init; } = new RepeatedField&lt;WorkoutDto&gt;();
  }
  public sealed class WorkoutDto
  {
      public Guid Id { get; init; }
  }
  </code></pre>
  <p>Mapping:</p>
  <pre><code>var mapperConfiguration =
                  new MapperConfiguration(_ =&gt;
                  {
                      _.CreateMap&lt;Horse, HorseDto&gt;();
                      _.CreateMap&lt;Workout, WorkoutDto&gt;();
                  });
  </code></pre>
  <p>When I do:</p>
  <pre><code>var horseDto = await context.Horse
                     .Where(_ =&gt; _.Workouts.Count &gt; 0)
                     .ProjectTo&lt;HorseDto&gt;(mapperConfiguration)
                     .FirstAsync();
  </code></pre>
  <p>I get:</p>
  <pre><code>System.ArgumentException: Argument types do not match
     at System.Linq.Expressions.Expression.Bind(MemberInfo member, Expression expression)
     at AutoMapper.QueryableExtensions.Impl.EnumerableExpressionBinder.BindEnumerableExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary`2 typePairCount, LetPropertyMaps letPropertyMaps)
     at AutoMapper.QueryableExtensions.Impl.EnumerableExpressionBinder.Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary`2 typePairCount, LetPropertyMaps letPropertyMaps)
     at AutoMapper.QueryableExtensions.ExpressionBuilder.&lt;&gt;c__DisplayClass10_0.&lt;CreateMapExpressionCore&gt;g__CreateMemberBinding|4(PropertyExpression propertyExpression, &lt;&gt;c__DisplayClass10_1&amp; )
     at AutoMapper.QueryableExtensions.ExpressionBuilder.&lt;&gt;c__DisplayClass10_0.&lt;CreateMapExpressionCore&gt;g__CreateMemberBindings|1()
     at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpressionCore(ExpressionRequest request, Expression instanceParameter, IDictionary`2 typePairCount, TypeMap typeMap, LetPropertyMaps letPropertyMaps)
     at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpressionCore(ExpressionRequest request, Expression instanceParameter, IDictionary`2 typePairCount, LetPropertyMaps letPropertyMaps, TypeMap&amp; typeMap)
     at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, IDictionary`2 typePairCount, LetPropertyMaps letPropertyMaps)
     at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request)
     at AutoMapper.Internal.LockingConcurrentDictionary`2.&lt;&gt;c__DisplayClass2_1.&lt;.ctor&gt;b__1()
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
     at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
     at System.Lazy`1.CreateValue()
     at System.Lazy`1.get_Value()
     at AutoMapper.Internal.LockingConcurrentDictionary`2.GetOrAdd(TKey key)
     at AutoMapper.QueryableExtensions.ExpressionBuilder.GetMapExpression(Type sourceType, Type destinationType, Object parameters, MemberInfo[] membersToExpand)
     at AutoMapper.QueryableExtensions.ProjectionExpression.ToCore(Type destinationType, Object parameters, IEnumerable`1 memberPathsToExpand)
     at AutoMapper.QueryableExtensions.ProjectionExpression.ToCore[TResult](Object parameters, IEnumerable`1 memberPathsToExpand)
     at AutoMapper.QueryableExtensions.ProjectionExpression.To[TResult](Object parameters, Expression`1[] membersToExpand)
     at AutoMapper.QueryableExtensions.Extensions.ProjectTo[TDestination](IQueryable source, IConfigurationProvider configuration, Object parameters, Expression`1[] membersToExpand)
     at AutoMapper.QueryableExtensions.Extensions.ProjectTo[TDestination](IQueryable source, IConfigurationProvider configuration, Expression`1[] membersToExpand)
     at RepeatedFieldExample.Sandbox.Run()
  </code></pre>
  <p>Everything works fine if I replace RepeatedField&lt;&gt; with IEnumerable&lt;&gt;.</p>
  <p>Workable direct LINQ Select:</p>
  <pre><code>var horseDto = await ctx.Horse
                          .Where(h =&gt; h.Workouts.Count &gt; 0)
                          .Select(h =&gt; new HorseDto()
                          {
                              Id = h.Id,
                              Workouts = new RepeatedField&lt;WorkoutDto&gt;()
                              {
                                  h.Workouts.Select(w =&gt; new WorkoutDto() {Id = w.Id})
                              }
                          })
                          .FirstAsync();
  </code></pre>
  <p>AutoMapper version is 10.1.1</p>