diff --git a/LiteDB/Engine/Services/LockService.cs b/LiteDB/Engine/Services/LockService.cs index cf4bbad97..1165d8d0b 100644 --- a/LiteDB/Engine/Services/LockService.cs +++ b/LiteDB/Engine/Services/LockService.cs @@ -53,8 +53,16 @@ public void ExitTransaction() { // if current thread are in reserved mode, do not exit transaction (will be exit from ExitExclusive) if (_transaction.IsWriteLockHeld) return; - - _transaction.ExitReadLock(); + + //This can be called when a lock has either been released by the slim or somewhere else therefore there is no lock to release from ExitReadLock() + if (_transaction.IsReadLockHeld) + { + try + { + _transaction.ExitReadLock(); + } + catch { } + } } /// @@ -148,4 +156,4 @@ public void Dispose() } } } -} \ No newline at end of file +}