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

FirstOrDefault causes transactions to be not removed #2483

Closed PatrickSlamp closed 3 weeks ago

PatrickSlamp commented 1 month ago

Version: 5.0.19

Describe the bug: As shown in the image below when using FirstOrDefault the transaction is not removed, when using ToList() in my case fixed it. When FirstOrDefault is used the yield return causes the ReleaseTransaction to be called. For contex the database on contained a single Tournament object the moment of reporting the bug.

Code to reproduce: See screenshot.

Expected behavior: The transaction should be released.

Screenshot: image

Originally posted by @PatrickSlamp in https://github.com/mbdavid/LiteDB/issues/2435#issuecomment-2119979483

JKamsker commented 3 weeks ago

This issue has been addressed and fixed in the latest commit. A new release is coming shortly. Reopen this issue or open a new one if this issue persists in the upcoming version please.