You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
InvalidOperationException is thrown when trying to create a litedb with a tempfilename (.tmp extension)
Stepping into source reveals the following line as the source of the exception. LiteEngine.cs:783PageBuffer buffer = this._disk.ReadFull(FileOrigin.Data).First<PageBuffer>();
However, when using any other extension ie Path.ChangeFileExtension(Path.GetTempFileName, ".db") makes the code work. I am not exactly sure whats going on as the litedb code doesnt seem to care about file extensions at all.
Expected behavior
No Exception being thrown, and an empty db file being created with whatever metadata necessary to exist with 0 collections inside
Screenshots/Stacktrace
System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.First[TSource](IEnumerable`1source)
at LiteDB.Engine.LiteEngine..ctor(EngineSettingssettings)
at LiteDB.ConnectionString.CreateEngine()
at LiteDB.LiteDatabase..ctor(ConnectionStringconnectionString,BsonMappermapper)
at LiteDB.LiteDatabase..ctor(StringconnectionString,BsonMappermapper)
at LiteDbDisposeRepro.Program.Main(String[]args)in C:\Users\deccer\RiderProjects\LiteDbDisposeRepro\LiteDbDisposeRepro\Program.cs:line 12
Additional context
I was actually trying to reproduce a bug where .Dispose-ing of the db engine takes ~5s every time, because of some string.Join showing up in the profiler
The text was updated successfully, but these errors were encountered:
@deccer This happened because LiteDB failed to initialize zero-byte files. It was fixed in the master, so it should be working now. In the meantime, in case you're stuck with the latest release, just delete the zero-byte temp file before opening it with LiteDB.
Version
5.0.10 (NuGet)
OS
Windows 10 1803 (17134)
Describe the bug
InvalidOperationException is thrown when trying to create a litedb with a tempfilename (.tmp extension)
Stepping into source reveals the following line as the source of the exception.
LiteEngine.cs:783
PageBuffer buffer = this._disk.ReadFull(FileOrigin.Data).First<PageBuffer>();
However, when using any other extension ie
Path.ChangeFileExtension(Path.GetTempFileName, ".db")
makes the code work. I am not exactly sure whats going on as the litedb code doesnt seem to care about file extensions at all.Code to Reproduce
Expected behavior
No Exception being thrown, and an empty db file being created with whatever metadata necessary to exist with 0 collections inside
Screenshots/Stacktrace
Additional context
I was actually trying to reproduce a bug where .Dispose-ing of the db engine takes ~5s every time, because of some string.Join showing up in the profiler
The text was updated successfully, but these errors were encountered: