dbelmont/ExpressionBuilder

AmbiguousMatchException problem

Closed this issue · 6 comments

Hello @dbelmont, I have a problem, can you please check that.

It keeps giving me an AmbiguousMatchException

Steps to produce

  • Add LambdaExpressionBuilder nuget packages.
    It is important to use nuget package. It does not give any error when I try it with using project reference.
    Tried nuget package versions: 2.0.1, 2.1.0-rc,

  • Try to create a simple filter, for example:
    (Tried on .netcore3.1)

public class TestClass
{
    public int Id { get; set; }
}

class Program
{
    static void Main(string[] args)
    {
        var filter = new Filter<TestClass>();
        filter.By("Id", Operation.EqualTo, 1);// that line gives an error as seen below
    }
}

image

System.TypeInitializationException
  HResult=0x80131534
  Message=The type initializer for 'ExpressionBuilder.Operations.Operation' threw an exception.
  Source=ExpressionBuilder
  StackTrace:
   at ExpressionBuilder.Operations.Operation.get_EqualTo()
   at test.Program.Main(String[] args) in D:\GitHub\ExpressionBuilder\test\Program.cs:line 16

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
TypeInitializationException: The type initializer for 'ExpressionBuilder.Helpers.OperationHelper' threw an exception.

Inner Exception 2:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 3:
AmbiguousMatchException: Ambiguous match found.

I have the same problem.

Hi,

got the same problem with the nuget package, while it's working well with the latest master.
Can you publish an updated nuget package please ?

Same problem with AmbiguousMatch!

Is this still open?

I have the same error on net core 3.1 using the latest version published on the nuget, any help??

I found & fixed the problem but I screwed up the pull request. Perhaps somebody else can replicate my changes and do it properly.

In the meantime (because I needed a working version of this package), you may try my fork https://www.nuget.org/packages/Akinzekeel.ExpressionBuilder/

Thanks, it worked like a charm.