The ToListAsync throws value cannot be null. ' an exception
Having IQueryable
var query = _db
.ApplicationPaidServices
.Include(it => it.Application)
.Include(it => it.Application.User)
.Where(it => Enum1.Value1 == it.Application.Enum1)
.Skip(0);
Execution 1
var result1 = await (from it in query
select it)
.ToListAsync();
work.
Execution 2
var result2 = await (from it in query
select
new
{ it })
.ToListAsync();
Issues ArgumentNullException
with the message: The value cannot be null. Parameter name: arguments [2]
stack trace
System.Dynamic.Utils.ContractUtils.RequiresNotNull (object value, string paramName, int index) System.Dynamic.Utils.ExpressionUtils.RequiresCanRead (expression expression, string paramName, int idx) System.Dynamic.Utils.ExpressionUtils.ValidateOneArgument (MethodBase , ExpressionType nodeKind, Expression Arguments, ParameterInfo pi, String MethodParamName, String ArgumentParamName, Int index) System.Dynamic.Utils.ExpressionUtils.ValidateArgumentTypes (MethodBase Method, ExpressionType nodeKind, Expressions.ReadOnlyCollection SystemLaram Arguments, String Method Call (Expression instance, MethodInfo method, IEnumerable args) Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.IncludeExpressionVisitor.VisitMethodCall (MethodCallExpressionCallExpression method) System.Linq.Expressions.MethodCallExpression.Accept (ExpressionVisitor Visitor)
By commenting either Where
or Skip
on the initial request, fixes the error.
I don't know what the reason is.
Using Npgsql.EntityFrameworkCore.PostgreSQL
and.NET Core 1.1
source to share