Open panthernet opened 4 years ago
Hi @panthernet, can you paste your stacktrace?
Here you go
at LiteDB.DictionaryExtensions.<ParseKeyValue>g__ReadValue|2_1(<>c__DisplayClass2_0& )
at LiteDB.DictionaryExtensions.ParseKeyValue(IDictionary`2 dict, String connectionString)
at LiteDB.ConnectionString..ctor(String connectionString)
at LiteDB.LiteDatabase..ctor(String connectionString, BsonMapper mapper)
at X.DB.DBManager.<Session>d__1.MoveNext() in D:\Projects\x\x\Classes\DB\DBManager.cs:line 86
And this is for the ticks exception
at System.DateTime..ctor(Int64 ticks, DateTimeKind kind)
at LiteDB.BufferSliceExtensions.ReadDateTime(BufferSlice buffer, Int32 offset)
at LiteDB.Engine.HeaderPage..ctor(PageBuffer buffer)
at LiteDB.Engine.LiteEngine..ctor(EngineSettings settings)
at LiteDB.ConnectionString.CreateEngine()
at LiteDB.LiteDatabase..ctor(ConnectionString connectionString, BsonMapper mapper)
at LiteDB.LiteDatabase..ctor(String connectionString, BsonMapper mapper)
at X.DB.DBManager.<Session>d__1.MoveNext() in D:\Projects\x\x\Classes\DB\DBManager.cs:line 86
same error here
I get this error when using a connection string. I did what the document says, and i get this error:
System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'
This exception was originally thrown at this call stack: LiteDB.DictionaryExtensions.ParseKeyValue.__ReadValue|2_1(ref LiteDB.DictionaryExtensions.<>c__DisplayClass2_0) LiteDB.DictionaryExtensions.ParseKeyValue(System.Collections.Generic.IDictionary<string, string>, string) LiteDB.ConnectionString.ConnectionString(string) LiteDB.LiteRepository.LiteRepository(string, LiteDB.BsonMapper) SampleForm.Form1.Form1_Load(object, System.EventArgs) in Form1.cs System.Windows.Forms.Form.OnLoad(System.EventArgs)
App.config
<configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> </startup> <connectionStrings> <add name="LiteDB" connectionString="Filename=C:\Users\<user>\Desktop\Database.db;Password='1234'" /> </connectionStrings> </configuration>
Source
using (var db = new LiteDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["LiteDB"].ConnectionString)) { ... }
Ok, I found a bug in ConnectionString parser, when finalize with '
. I'm fixing.... for now, just remove open/close '
Got the same error:
Unhandled exception. System.ArgumentOutOfRangeException: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. (Parameter 'ticks')
at System.DateTime..ctor(Int64 ticks, DateTimeKind kind)
at LiteDB.BufferSliceExtensions.ReadDateTime(BufferSlice buffer, Int32 offset)
at LiteDB.Engine.HeaderPage..ctor(PageBuffer buffer)
at LiteDB.Engine.LiteEngine..ctor(EngineSettings settings)
at LiteDB.ConnectionString.CreateEngine()
at LiteDB.LiteDatabase..ctor(ConnectionString connectionString, BsonMapper mapper)
at LiteDB.LiteDatabase..ctor(String connectionString, BsonMapper mapper)
at ConsoleApp1.Program.Main(String[] args) in
My DB does not have any passwords set.
@alex-fomin Could you provide your datafile and the connection string you're using?
The datafile is pretty big (73Mb): https://www.dropbox.com/s/5agkno8ikr2mb2t/ProcessingQueue.db?dl=0 Connection string is just "ProcessingQueue.db"
@alex-fomin The file you sent appears to be a SQLite datafile.
Ok, I found a bug in ConnectionString parser, when finalize with
'
. I'm fixing.... for now, just remove open/close'
I believe the same issue is with $ character. While interpolating some strings I mistyped the name of the DB and got the same error. Oh, and in my case, I have no password on the DB.
System.ArgumentOutOfRangeException: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
at System.DateTime..ctor(Int64 ticks, DateTimeKind kind)
at LiteDB.BufferSliceExtensions.ReadDateTime(BufferSlice buffer, Int32 offset)
at LiteDB.Engine.LiteEngine..ctor(EngineSettings settings)
at LiteDB.ConnectionString.CreateEngine()
at LiteDB.LiteDatabase..ctor(ConnectionString connectionString, BsonMapper mapper)
I have a similar scenario.
System.ArgumentOutOfRangeException: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks at System.DateTime..ctor(Int64 ticks, DateTimeKind kind) at LiteDB.BufferSliceExtensions.ReadDateTime(BufferSlice buffer, Int32 offset) at LiteDB.Engine.LiteEngine..ctor(EngineSettings settings) at LiteDB.SharedEngine.OpenDatabase() at LiteDB.SharedEngine.Pragma(String name, BsonValue value)
DB is located in C:\Users\
The user in question installed the application, and on the first-run - the DB was generated, not long after opening the app, the app performs a GetAll on a collection in the DB - the GetAll call triggered the exception.
I have a copy of the DB and I get the same issue if I try to use my app to access the data. I also get the issue if I try to connect to the DB using LiteDb Studio.
For the user - deleting the DB that was originally created and letting the app create a new one resolved the issue. @lbnascimento - would the db be helpful to you at all in debugging the issue?
I have the same problem described by @alex-nicholas Is there a solution?
Hi, I'm following the v5 guide but stuck with the System.IndexOutOfRangeException exception when I try to access the database with the password. Here's the code, .NET Core 3.1.
var str = $"Filename={path};Password='{verylongpwd}'"; using var db = new LiteDatabase(str);
The string sample is:
Filename=C:\Users\yup\AppData\Roaming\corex\storecore.file;Password='1495c305c5312dd1a9a18d9502daa0369216763ca7a6f537ddbe290241cf8aad1ca326313adec74bb98d1955747347cf0e3f087899d8bb2e0aa002ff825e1c0f25eaa79e5dfbf1c0e2daf6746a3a3f140244b764204c20c0ccede3521eaf8537ae32d4b13a04f1c387f56a8d6fa095bc53451c1892a46b8182afd94559cd7377aebc8d4a2b4883c637a359e6e67e1d8c2d789721351ebb000409329b2e875d21278b7c76724c68729e53dac50168564b8c3432018212a111c952e593829b42c296458cc0020174aaef9ca6b5661ca965004404c2bbb256bc41a8aa5c5349c615e40328a3263c45e5f96e61048149e98aa8b6f2afb59d73379e1dce5429752d8d'
If I add ; to the end of the string, I get
System.ArgumentOutOfRangeException: 'Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. (Parameter 'ticks')'
It is very confusing for the moment.