Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Found Bug at System.Core.dll

$
0
0

.Net Framework 4.6

 

Sample Code

Expression left = Expression.Constant(value, typeof(DateTime));
Expression right = Expression.Constant(value2, typeof(DateTime));

//works corretly
System.Linq.Expressions.Expression sub = Expression.Subtract(left, right);

//The binary operator Add is not defined for the types 'System.DateTime' and 'System.DateTime'
System.Linq.Expressions.Expression searchExpression = Expression.Add(left, right);

NOTE:-Left and right both of type System.DateTime

 

 

Exception Details

 

An exception of type 'System.InvalidOperationException' occurred in System.Core.dll but was not handled in user code

Additional information: The binary operator Add is not defined for the types 'System.DateTime' and 'System.DateTime'.

 

Stack Trace:

   at System.Linq.Expressions.Expression.GetUserDefinedBinaryOperatorOrThrow(ExpressionType binaryType, String name, Expression left, Expression right, Boolean liftToNull)

   at System.Linq.Expressions.Expression.Add(Expression left, Expression right, MethodInfo method)

   at System.Linq.Expressions.Expression.Add(Expression left, Expression right)

   at MyClass.Filter[TEntity,TProperty](IQueryable`1 source, Expression`1 property, TProperty value)

 


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>