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
Describe the bug
Get items by ids from ICollection throw exception: System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'index')
Code to Reproduce
public class StateModel
{
[BsonId]
public ObjectId Id { get; set; }
}
[Fact]
public void MyTest()
{
using var db = new LiteDatabase(":memory:");
var col = db.GetCollection<StateModel>("col");
ICollection<ObjectId> ids = new List<ObjectId>();
for (var i = 1; i <= 10; i++)
ids.Add(col.Insert(new StateModel()));
var items = col.Query()
.Where(x => ids.Contains(x.Id))
.ToList();
items.Should().HaveCount(10);
}
Expected behavior
No exception throw. Test passed.
Screenshots/Stacktrace
System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'index')
at System.Linq.Expressions.InstanceMethodCallExpression1.GetArgument(Int32 index)
at System.Dynamic.Utils.ListArgumentProvider.GetElement(Int32 index)
at System.Dynamic.Utils.ListProvider`1.get_Item(Int32 index)
at System.Collections.ObjectModel.ReadOnlyCollection`1.System.Collections.Generic.IList<T>.get_Item(Int32 index)
at LiteDB.LinqExpressionVisitor.ResolvePattern(String pattern, Expression obj, IList`1 args) in C:\Users\micky\Documents\Source\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs:line 511
at LiteDB.LinqExpressionVisitor.VisitMethodCall(MethodCallExpression node) in C:\Users\micky\Documents\Source\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs:line 213
at System.Linq.Expressions.MethodCallExpression.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) in C:\Users\micky\Documents\Source\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs:line 95
at System.Linq.Expressions.Expression`1.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at LiteDB.LinqExpressionVisitor.Resolve(Boolean predicate) in C:\Users\micky\Documents\Source\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs:line 64
at LiteDB.BsonMapper.GetExpression[T,K](Expression`1 predicate) in C:\Users\micky\Documents\Source\LiteDB\LiteDB\Client\Mapper\BsonMapper.cs:line 179
at LiteDB.LiteQueryable`1.Where(Expression`1 predicate) in C:\Users\micky\Documents\Source\LiteDB\LiteDB\Client\Database\LiteQueryable.cs:line 98
at LiteDB.Tests.Database.MultiKey_Mapper_Tests.MyTest() in C:\Users\micky\Documents\Source\LiteDB\LiteDB.Tests\Database\MultiKey_Mapper_Tests.cs:line 71
The text was updated successfully, but these errors were encountered:
Version
5.0.8
Describe the bug
Get items by ids from
ICollection
throw exception:System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'index')
Code to Reproduce
Expected behavior
No exception throw. Test passed.
Screenshots/Stacktrace
The text was updated successfully, but these errors were encountered: