-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Empty value in indexed field throws exception #1597
Comments
that was the cause of my issue and has been fixed but no release made yet. |
I got same error NRE. My case
Call method like this
end got error
As you can see, I was build from master. I was debug LiteDb and find that in this place I get null in BsonDocument object. next steps in debugger |
With InsertBulk, I got similar error.
|
@riksking Your issue is very different. First of all, you're opening your collection with The error is happening because you're trying to store strings in your I'm going to close this issue, since the original problem is already fixed in the master. If you have any questions, please open another issue. |
Version
5.05
Framework Version 4.8
Describe the bug
When inserting a record with a Empty String in a indexed field and exception is thrown.
Code to Reproduce
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LiteDB;
namespace LiteDBBug
{
public class MyRecord
{
[BsonId]
public int Id { get; set; }
public String Field11 { get; set; }
public String Field22 { get; set; }
public String Field33 { get; set; }
}
}
Expected behavior
Record should be stored into database
Screenshots/Stacktrace
System.NullReferenceException: Object reference not set to an instance of an object.
at LiteDB.BsonValue.GetHashCode()
at System.Collections.Generic.GenericEqualityComparer
1.GetHashCode(T obj) at System.Linq.Set
1.InternalGetHashCode(TElement value)at System.Linq.Set
1.Find(TElement value, Boolean add) at System.Linq.Enumerable.<DistinctIterator>d__64
1.MoveNext()at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data)
at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.b__0(TransactionService transaction)
at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func
2 fn) at LiteDB.Engine.LiteEngine.Insert(String collection, IEnumerable
1 docs, BsonAutoId autoId)at LiteDB.LiteCollection`1.Insert(T entity)
at LiteDBBug.Program.Main(String[] args) in C:\TFSSrc\Test\LiteDBBug\LiteDBBug\Program.cs:line 50
The text was updated successfully, but these errors were encountered: