LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

Opening with ReadOnly=true an already opened Connection=direct database fails on Dispose

Open superware opened this issue 2 years ago • 1 comments

Hello,

On v5.0.16, I have a database opened with Connection=direct (default) in one process.

Another process opens with ReadOnly=true, successfully opening and reading (GetCollection), but as soon as Dispose is called:

System.NotSupportedException: Stream does not support writing.
   at System.IO.__Error.WriteNotSupported()
   at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
   at LiteDB.Engine.DiskService.Write(IEnumerable`1 pages, FileOrigin origin)
   at LiteDB.Engine.WalIndexService.CheckpointInternal()
   at LiteDB.Engine.WalIndexService.TryCheckpoint()
   at LiteDB.Engine.LiteEngine.Dispose(Boolean disposing)
   at LiteDB.Engine.LiteEngine.Dispose()
   at LiteDB.LiteDatabase.Dispose(Boolean disposing)
   at LiteDB.LiteDatabase.Dispose()

Guessing ReadOnly=true should NEVER write anything, am I doing something wrong? Can this be fixed please?

Thank you in advance.

superware avatar Jul 27 '23 11:07 superware

Anyone?

superware avatar Oct 27 '23 19:10 superware