question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Release 5.0.5 is bad - multiple issues with code working on past version

See original GitHub issue

Version LiteDB 5.0.5 on dotnet core 3.1 windows and linux

Describe the bug null pointers coming from multi different actions inside LiteDB on code thar was working on version 5.0.4. (was having an issue with records not been found sometimes but i think that relates to bug someelse reported)

Code to Reproduce putting lines from my code so may not be perfect but should give rough idea.

_db = new LiteDatabase( "MappingAndWriteCache.db");
_mappings = _db.GetCollection<MappingRecord>();
_mappings.EnsureIndex("Status", record => record.Status);
_mappings.EnsureIndex("DataSourceFileId", record => record.DataSourceFileId);
_mappings.EnsureIndex("FileId", record => record.FileId);
_mappings.Upsert(new MappingRecord
                {
                    Id = id,
                    FileId = fileId,
                    BlockNbr = blockNbr,
                    DataSourceFileId = null,
                    DataSourceFileBlockOffset = 0,
                    DataSourceFileBlockLength = block.Length,
                    LastModified = DateTime.UtcNow,
                    Status = BlockStatus.New
                });

public enum BlockStatus { New, BatchedForUpload, Uploaded, Empty }

public class MappingRecord
{
    public string Id { get; set; }
    public string FileId { get; set; }
    public uint BlockNbr { get; set; }
    public string DataSourceFileId { get; set; }
    public long DataSourceFileBlockOffset { get; set; }
    public int DataSourceFileBlockLength { get; set; }
    public DateTime LastModified { get; set; }
    public BlockStatus Status { get; set; }
}

Expected behavior Upsert should happen without null pointer below.

Screenshots/Stacktrace

System.NullReferenceException: Object reference not set to an instance of an object.
   at LiteDB.BsonValue.GetHashCode()
   at System.Linq.Set`1.InternalGetHashCode(TElement value)
   at System.Linq.Set`1.Add(TElement value)
   at System.Linq.Enumerable.DistinctIterator`1.MoveNext()
   at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data)
   at LiteDB.Engine.LiteEngine.<>c__DisplayClass30_0.<Upsert>b__0(TransactionService transaction)
   at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn)
   at LiteDB.Engine.LiteEngine.Upsert(String collection, IEnumerable`1 docs, BsonAutoId autoId)
   at LiteDB.LiteCollection`1.Upsert(IEnumerable`1 entities)
   at LiteDB.LiteCollection`1.Upsert(T entity)

Additional context This is the easiest one to isolate but basically all my unit tests over code using litedb is now failing with a lot of null pointers from different calls.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
lbnascimentocommented, Apr 2, 2020

This issue is already fixed in master and its fix will be present in the next incremental release.

2reactions
seertenedoscommented, Mar 27, 2020

Great. You should enable a prerelease that always points to the latest master. Then people like myself can test fixes etc and some people may run or test versions before release. I would love to test this fix and the other fix in 5.0.5 to see if it fixes some strangeness i have with records coming back on a find on the first call but not the second right after each other in a transaction for the same record some times.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to version bug fix of library for earlier release?
If later on, we introduce some backward compatible fix in the library in 2.1.0 (develop branch), the version should be changed to 1.5.1,...
Read more >
Running a .NET 5 project on macOS M1 with .NET 6 leads ...
.NET SDK (reflecting any global.json): Version: ... Your main issue is that VS Code doesn't seamlessly support multiple SDKs across ...
Read more >
F5OS-A 1.3.1 Fixes and Known Issues Release Notes
Even if the system is reverted to the previous software version, the issue remains and the system will be unable to launch tenants....
Read more >
Release Notes for TheHive 5.0
Fix indentation issue in TTP list; Fix overflow in pages with long content; Fix loading of multiple comments; Allow importing observables from analyzers...
Read more >
Changelog
Known Issues. Standard and multi-version upgrades are not currently working from Sourcegraph versions 5.0.X to 5.1.5. As a temporary workaround, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found