LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

Application crash at DropCollection

Open InesCodMon opened this issue 1 year ago • 2 comments

Version v5.0.18 and v5.0.19 /MacOS/.NET Standard 2.0

Describe the bug I want to clean up the database (remove all collections and their content). But an error occurs when DropCollection is called the first time.

Code to Reproduce public void CleanupDatabase() { IEnumerable listOfCollections = _db.GetCollectionNames(); foreach (string item in listOfCollections) { Console.WriteLine("COLLECTION" + item.ToString()); _db.DropCollection(item); } }

Expected behavior All collections should be removed. The above code is expected to work the same as it does in version v5.0.17.

Screenshots/Stacktrace The below error occurs when the DropCollection method is called.

LiteDB.LiteException: The current thread already contains an open transaction. Use the Commit/Rollback method to release the previous transaction. at LiteDB.Engine.LiteEngine.DropCollection (System.String name) [0x0003e] in :0 at LiteDB.LiteDatabase.DropCollection (System.String name) [0x00013] in :0

InesCodMon avatar Mar 25 '24 08:03 InesCodMon

I encountered the same error while migrating from v5.0.17 to v5.0.19

LiteDB.LiteException: The current thread already contains an open transaction. Use the Commit/Rollback method to release the previous transaction. at LiteDB.Engine.LiteEngine.DropCollection (System.String name) [0x0003e] in <757508dac4404cdea3f8947f089148e1>:0 at LiteDB.LiteDatabase.DropCollection (System.String name) [0x00013] in <757508dac4404cdea3f8947f089148e1>:0

I tried both Commit and Rollback before performing the drop, but it didn't work. I think for now I'll revert back to version 17.

fabiorme avatar Apr 17 '24 12:04 fabiorme

I encountered the same error while migrating from v5.0.17 to v5.0.19

Same.

AlekseiKozhukhov avatar Apr 22 '24 08:04 AlekseiKozhukhov

Thank you for reporting this issue.

This issue has been resolved in the latest version of LiteDB. Please update to the latest version of LiteDB to resolve this issue. If the issue persists, please let us know.

JKamsker avatar Jun 05 '24 08:06 JKamsker

Still seeing this behavior.

indieshack avatar Sep 19 '24 21:09 indieshack