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
Which LiteDB version/OS/.NET framework version are you using. (REQUIRED)
5.0.5 on master
Describe the bug
A clear and concise description of what the bug is.
when
db.GetCollection("Person").Find(x => x.Sex == PersonSex.Female);
is ok
when
var PersonSexFemale = PersonSex.Female;
var p = db.GetCollection("Person").Find(x => x.Sex == PersonSexFemale);
Exception
[xUnit.net 00:00:44.75] LiteDB.Tests.Database.Enum_Tests.FindFemale [FAIL]
[xUnit.net 00:00:44.76] System.NullReferenceException : Object reference not set to an instance of an object.
[xUnit.net 00:00:44.76] Stack Trace:
[xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs(432,0): at LiteDB.LinqExpressionVisitor.VisitBinary(BinaryExpression node)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression1 node) [xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs(95,0): at LiteDB.LinqExpressionVisitor.VisitLambda[T](Expression1 node)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.Expression1.Accept(ExpressionVisitor visitor) [xUnit.net 00:00:44.76] at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) [xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs(64,0): at LiteDB.LinqExpressionVisitor.Resolve(Boolean predicate) [xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\BsonMapper.cs(175,0): at LiteDB.BsonMapper.GetExpression[T,K](Expression1 predicate)
[xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Database\Collections\Find.cs(54,0): at LiteDB.LiteCollection1.Find(Expression1 predicate, Int32 skip, Int32 limit)
[xUnit.net 00:00:44.76] e:\Projects\TeamMe\LiteDB\LiteDB.Tests\Database\Enum_Tests.cs(42,0): at LiteDB.Tests.Database.Enum_Tests.FindFemale()
Code to Reproduce
Write a small snippet to isolate your bug and could be possible to our team test. (REQUIRED)
public class Enum_Tests
{
public enum PersonSex
{
Male,
Female
}
public class Person
{
public int Id { get; set; }
public string Fullname { get; set; }
public PersonSex Sex { get; set; }
}
[Fact]
public void FindFemale()
{
using (var f = new TempFile())
{
using (var db = new LiteDatabase(f.Filename))
{
var col = db.GetCollection<Person>("Person");
col.Insert(new Person { Fullname = "John", Sex = PersonSex.Male });
col.Insert(new Person { Fullname = "Doe", Sex = PersonSex.Male });
col.Insert(new Person { Fullname = "Joana", Sex = PersonSex.Female });
col.Insert(new Person { Fullname = "Marcus", Sex = PersonSex.Male });
}
// close datafile
using (var db = new LiteDatabase(f.Filename))
{
var PersonSexFemale = PersonSex.Female;
var p = db.GetCollection<Person>("Person").Find(x => x.Sex == PersonSexFemale);
p.Count().Should().Be(1);
}
}
}
}
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots/Stacktrace
If applicable, add screenshots/stacktrace
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Version
Which LiteDB version/OS/.NET framework version are you using. (REQUIRED)
5.0.5 on master
Describe the bug
A clear and concise description of what the bug is.
when
db.GetCollection("Person").Find(x => x.Sex == PersonSex.Female);
when
var PersonSexFemale = PersonSex.Female;
var p = db.GetCollection("Person").Find(x => x.Sex == PersonSexFemale);
[xUnit.net 00:00:44.75] LiteDB.Tests.Database.Enum_Tests.FindFemale [FAIL]
[xUnit.net 00:00:44.76] System.NullReferenceException : Object reference not set to an instance of an object.
[xUnit.net 00:00:44.76] Stack Trace:
[xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs(432,0): at LiteDB.LinqExpressionVisitor.VisitBinary(BinaryExpression node)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
[xUnit.net 00:00:44.76] at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression
1 node) [xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs(95,0): at LiteDB.LinqExpressionVisitor.VisitLambda[T](Expression
1 node)[xUnit.net 00:00:44.76] at System.Linq.Expressions.Expression
1.Accept(ExpressionVisitor visitor) [xUnit.net 00:00:44.76] at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) [xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\Linq\LinqExpressionVisitor.cs(64,0): at LiteDB.LinqExpressionVisitor.Resolve(Boolean predicate) [xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Mapper\BsonMapper.cs(175,0): at LiteDB.BsonMapper.GetExpression[T,K](Expression
1 predicate)[xUnit.net 00:00:44.76] E:\Projects\TeamMe\LiteDB\LiteDB\Client\Database\Collections\Find.cs(54,0): at LiteDB.LiteCollection
1.Find(Expression
1 predicate, Int32 skip, Int32 limit)[xUnit.net 00:00:44.76] e:\Projects\TeamMe\LiteDB\LiteDB.Tests\Database\Enum_Tests.cs(42,0): at LiteDB.Tests.Database.Enum_Tests.FindFemale()
Code to Reproduce
Write a small snippet to isolate your bug and could be possible to our team test. (REQUIRED)
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots/Stacktrace
If applicable, add screenshots/stacktrace
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: