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
version 4.1.1 introduced a bug with comparing enum values.
The bug still persists, when the the left and right side are explicitly cast to an integer.
The example works in version 4.1.0.
A minimal example:
using System.Linq.Expressions;using AgileObjects.ReadableExpressions;namespaceErrorReproduction{publicclassProgram{staticvoidMain(string[]args){Expression<Func<ProductionOrder,bool>>exp=p => p.Status < Status.Done;
Console.WriteLine(exp.ToReadableString());}publicenumStatus{Open=1,Working=11,Done=31,}publicclassProductionOrder{publicStatusStatus{get;set;}}}}
System.InvalidOperationException: The binary operator LessThan is not defined for the types 'ErrorReproduction.Program+Status' and 'ErrorReproduction.Program+Status'.
at System.Linq.Expressions.Expression.GetUserDefinedBinaryOperatorOrThrow(ExpressionType binaryType, String name, Expression left, Expression right, Boolean liftToNull)
at System.Linq.Expressions.Expression.LessThan(Expression left, Expression right, Boolean liftToNull, MethodInfo method)
at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right, Boolean liftToNull, MethodInfo method, LambdaExpression conversion)
at System.Linq.Expressions.BinaryExpression.Update(Expression left, LambdaExpression conversion, Expression right)
at AgileObjects.ReadableExpressions.Translations.BinaryTranslation.TryGetEnumComparisonExpression(BinaryExpression& comparison)
at AgileObjects.ReadableExpressions.Translations.BinaryTranslation.For(BinaryExpression binary, ITranslationContext context)
at AgileObjects.ReadableExpressions.Translations.ExpressionTranslation.GetDefaultTranslation(Expression expression)
at AgileObjects.ReadableExpressions.Translations.ExpressionTranslation.GetTranslationFor(Expression expression)
at AgileObjects.ReadableExpressions.Extensions.PublicTranslationContextExtensions.GetCodeBlockTranslationFor(ITranslationContext context, Expression expression)
at AgileObjects.ReadableExpressions.Translations.LambdaTranslation..ctor(LambdaExpression lambda, ITranslationContext context)
at AgileObjects.ReadableExpressions.Translations.ExpressionTranslation.GetDefaultTranslation(Expression expression)
at AgileObjects.ReadableExpressions.Translations.ExpressionTranslation.GetTranslationFor(Expression expression)
at AgileObjects.ReadableExpressions.Translations.ExpressionTranslation.GetTranslation()
at AgileObjects.ReadableExpressions.ExpressionExtensions.ToReadableString(Expression expression, Func`2 configuration)
at AgileObjects.ReadableExpressions.Visualizers.ObjectSource.ExpressionVisualizerObjectSource.GetTranslationFor(Object target)
at AgileObjects.ReadableExpressions.Visualizers.ObjectSource.ExpressionVisualizerObjectSource.GetData(Object target, Stream outgoingData, Action`2 serializer)
The text was updated successfully, but these errors were encountered:
Hello,
version 4.1.1 introduced a bug with comparing enum values.
The bug still persists, when the the left and right side are explicitly cast to an integer.
The example works in version 4.1.0.
A minimal example:
The text was updated successfully, but these errors were encountered: