Closed
Description
openedon Oct 6, 2020
query:
ss.Set<Level1>()
.Where(l1 => l1.Id < 2)
.Select(l1 => new
{
l1.Id,
Pushdown = l1.OneToMany_Optional1
.Where(x => x.Name == "L2 02")
.FirstOrDefault().OneToMany_Optional2.ToList()
})
exception:
GenericArguments[2], 'System.Collections.Generic.ICollection`1[Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel.Level3]', on 'Void PopulateCollection[TCollection,TElement,TRelatedEntity](Int32, Microsoft.EntityFrameworkCore.Query.QueryContext, System.Data.Common.DbDataReader, Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryResultCoordinator, System.Func`3[Microsoft.EntityFrameworkCore.Query.QueryContext,System.Data.Common.DbDataReader,System.Object[]], System.Func`3[Microsoft.EntityFrameworkCore.Query.QueryContext,System.Data.Common.DbDataReader,System.Object[]], System.Func`3[Microsoft.EntityFrameworkCore.Query.QueryContext,System.Data.Common.DbDataReader,System.Object[]], System.Collections.Generic.IReadOnlyList`1[Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer], System.Collections.Generic.IReadOnlyList`1[Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer], System.Collections.Generic.IReadOnlyList`1[Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer], System.Func`5[Microsoft.EntityFrameworkCore.Query.QueryContext,System.Data.Common.DbDataReader,Microsoft.EntityFrameworkCore.Query.Internal.ResultContext,Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryResultCoordinator,TRelatedEntity])' violates the constraint of type 'TRelatedEntity'.
---- System.Security.VerificationException : Method Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor+ShaperProcessingExpressionVisitor.PopulateCollection: type argument 'System.Collections.Generic.ICollection`1[Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel.Level3]' violates the constraint of type parameter 'TRelatedEntity'.
Stack Trace:
RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
ShaperProcessingExpressionVisitor.VisitExtension(Expression extensionExpression) line 755
ShaperProcessingExpressionVisitor.ProcessShaper(Expression shaperExpression, RelationalCommandCache& relationalCommandCache, LambdaExpression& relatedDataLoaders) line 277
RelationalShapedQueryCompilingExpressionVisitor.VisitShapedQuery(ShapedQueryExpression shapedQueryExpression) line 64
ShapedQueryCompilingExpressionVisitor.VisitExtension(Expression extensionExpression) line 95
QueryCompilationContext.CreateQueryExecutor[TResult](Expression query) line 179
Database.CompileQuery[TResult](Expression query, Boolean async) line 72
QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async) line 112
<>c__DisplayClass9_0`1.<Execute>b__0() line 96
CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler) line 76
QueryCompiler.Execute[TResult](Expression query) line 92
EntityQueryProvider.Execute[TResult](Expression expression) line 79
EntityQueryable`1.GetEnumerator() line 91
List`1.ctor(IEnumerable`1 collection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment