mbdavid / LiteDB

LiteDB - A .NET NoSQL Document Store in a single data file
http://www.litedb.org
MIT License
8.35k stars 1.22k forks source link

[BUG] Program freezes when I insert and then update the LiteDB in version 5.0.18 and 5.0.19 #2464

Closed KC7465128305 closed 2 months ago

KC7465128305 commented 2 months ago

Version LiteDB 5.0.19/Windows 11/.NET 8.0

Describe the bug Everything is fine when I used LiteDB 5.0.17. When I upgraded to 5.0.18 or 5.0.19 is when the bug occurred

Code to Reproduce I have created and attached a small program to reproduce the issue. The program reads a Northwind SQLite database and created and write the database tables and columns into a LiteDB database called FileOne.db on the desktop. The bug occurred when an insert followed by an update to the LiteDB database. I have also included a video showing everything is fine with LiteDB 5.0.17 but when I upgraded it to 5.0.19, the program freezes.

Expected behavior A file called FileOne.db is created at the desktop and the program does not freeze.

Screenshots/Stacktrace An example program and a video are attached.

Additional context Add any other context about the problem here. ImportDBUsingLiteDB.zip

https://github.com/mbdavid/LiteDB/assets/61445498/b772dfeb-5734-4edc-8d87-81f716e499bf

ltetak commented 2 months ago

@KC7465128305 https://github.com/mbdavid/LiteDB/pull/2447 this should fix your problem. You can workaround it by changing your code as well but it should not be required.

KC7465128305 commented 2 months ago

@KC7465128305 #2447 this should fix your problem. You can workaround it by changing your code as well but it should not be required.

After I switch from TaskScheduler.FromCurrentSynchronizationContext() to TaskScheduler.Default I can upgrade to version 5.0.19. Thanks for the pointer.