Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] #1678

Closed
Tangerie opened this issue May 10, 2020 · 1 comment
Closed

[BUG] #1678

Tangerie opened this issue May 10, 2020 · 1 comment
Labels

Comments

@Tangerie
Copy link

Tangerie commented May 10, 2020

I'm using:
.Net Core 3.1
Windows
LiteDB 5.07
AspNet.WebApi.Cor 5.2.7

I get an error sometimes when querying a collection with some filters. Ive included the error message below.

Code to Reproduce

var list = propertyCollection.Query()
                .Where(x => x.Id == 1)
                .Where(x => x.active)
                .Where(x => x.address.Contains("Test"))
                .ToList();

Heres the error message
An item with the same key has already been added. Key: Boolean Contains[Int32](System.Collections.Generic.IEnumerable`1[System.Int32], Int32)

Stacktrace

   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at LiteDB.Reflection.MethodName(MethodInfo method, Int32 skipParameters)
   at LiteDB.EnumerableResolver.ResolveMethod(MethodInfo method)
   at LiteDB.LinqExpressionVisitor.VisitMethodCall(MethodCallExpression node)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at LiteDB.LinqExpressionVisitor.VisitConditional(ConditionalExpression node)
   at System.Linq.Expressions.ConditionalExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression`1 node)
   at LiteDB.LinqExpressionVisitor.VisitLambda[T](Expression`1 node)
   at System.Linq.Expressions.Expression`1.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at LiteDB.LinqExpressionVisitor.Resolve(Boolean predicate)
   at LiteDB.BsonMapper.GetExpression[T,K](Expression`1 predicate)
   at LiteDB.LiteQueryable`1.Where(Expression`1 predicate)
   at EmailBotAspNet.Services.Database.DatabaseManager.GetProperties(FilterData filter, SortType sort) in L:\Coding\Realestate Bot\EmailBotAspNet\EmailBotAspNet\Services\Database\DatabaseManager.cs:line 156
   at EmailBotAspNet.Controllers.RequestController.Get(String type, String sort, String ids, String isActive, String inTimeFrame, String name, String auth) in L:\Coding\Realestate Bot\EmailBotAspNet\EmailBotAspNet\Controllers\RequestController.cs:line 34
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()```
@Tangerie Tangerie added the bug label May 10, 2020
@lbnascimento
Copy link
Contributor

@JoshuaC01 Could you test with the latest master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants