Version
5.0.5
Describe the bug
FindById sporadically throws System.Threading.SynchronizationLockException: "The read lock is being released without being held."
Code to Reproduce
Here how I use FindById -it is hard to reproduce the issue though
public T FindById<T>(int id)
{
var data = database.GetCollection<T>(typeof(T).Name).FindById(new BsonValue(id));
if (Equals(data, default(T)))
{
throw new InvalidOperationException($"Cannot find {typeof(T).Name} with id {id}");
}
return data;
}
Expected behavior
No exceptions.
Screenshots/Stacktrace
"ClassName": "System.Threading.SynchronizationLockException",
"Message": "The read lock is being released without being held.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.Threading.ReaderWriterLockSlim.ExitReadLock()\r\n at LiteDB.Engine.TransactionMonitor.ReleaseTransaction(TransactionService transaction)\r\n at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)\r\n at LiteDB.Engine.LiteEngine.Query(String collection, Query query)\r\n at LiteDB.LiteQueryable1.<ToDocuments>d__26.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at
Additional context
Add any other context about the problem here.
Version
5.0.5
Describe the bug
FindById sporadically throws System.Threading.SynchronizationLockException: "The read lock is being released without being held."
Code to Reproduce
Here how I use FindById -it is hard to reproduce the issue though
Expected behavior
No exceptions.
Screenshots/Stacktrace
"ClassName": "System.Threading.SynchronizationLockException",
"Message": "The read lock is being released without being held.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.Threading.ReaderWriterLockSlim.ExitReadLock()\r\n at LiteDB.Engine.TransactionMonitor.ReleaseTransaction(TransactionService transaction)\r\n at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)\r\n at LiteDB.Engine.LiteEngine.Query(String collection, Query query)\r\n at LiteDB.LiteQueryable
1.<ToDocuments>d__26.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n atAdditional context
Add any other context about the problem here.