You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have table with property A of type int. I need to dynamically select data and map to class that has property A, but is enum instead of int.
Exception
Exception message: Value cannot be null. Parameter name: expression.
Stack trace:
at System.Linq.Expressions.Expression.RequiresCanRead(Expression expression, String paramName)
at System.Linq.Expressions.Expression.Bind(MemberInfo member, Expression expression)
at System.Linq.Dynamic.Core.Parser.ExpressionParser.CreateNewExpression(List`1 properties, List`1 expressions, Type newType)
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNew()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIdentifier()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParsePrimaryStart()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParsePrimary()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseUnary()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseMultiplicative()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAdditive()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseShiftOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseComparisonOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLogicalAndOrOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIn()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAndOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseOrOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLambdaOperator(
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNullCoalescingOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseConditionalOperator()
at System.Linq.Dynamic.Core.Parser.ExpressionParser.Parse(Type resultType, Boolean createParameterCtor)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Type delegateType, ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, Type itType, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Select[TResult](IQueryable source, ParsingConfig config, String selector, Object[] args)
at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Select[TResult](IQueryable source, String selector, Object[] args)
Reproduction
Here is .NET fiddle that reproduces the issue. It seems that problem occurs, because enum is considered to be a TypeCode.Object here:
Description
I have table with property
A
of typeint
. I need to dynamically select data and map to class that has propertyA
, but is enum instead ofint
.Exception
Reproduction
Here is .NET fiddle that reproduces the issue. It seems that problem occurs, because enum is considered to be a
TypeCode.Object
here:System.Linq.Dynamic.Core/src/System.Linq.Dynamic.Core/Parser/TypeHelper.cs
Line 55 in 52d0831
As a result, check below fails and returns
null
:System.Linq.Dynamic.Core/src/System.Linq.Dynamic.Core/Parser/TypeHelper.cs
Lines 113 to 123 in 52d0831
The text was updated successfully, but these errors were encountered: