praeclarum / sqlite-net

Simple, powerful, cross-platform SQLite client and ORM for .NET
MIT License
4.01k stars 1.42k forks source link

Sqlite-net newbie, always Index was out of range ? #786

Open senyung opened 5 years ago

senyung commented 5 years ago

hi, Im new using sqllite-net, always got error Index was out of range, something is not clean ?

here my example:

            string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "TestDB");
            SQLiteConnection dbTest = new SQLiteConnection(dbPath);
            dbTest.CreateTable<TestTable>();

            dbTest.Insert(new TestTable() { TestField = @"ABC\123", }); //<--**ALWAYS ERROR HERE ON SECOND RUN**

Step :

  1. Run F5 for firstime is ok
  2. Close the apps
  3. Run F5 Second time got error :

Unhandled Exception:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Any help will be appreciated TIA Sen

praeclarum commented 5 years ago

Hi, I'm having trouble reproducing. Would you tell me which platform you're running on and what properties does TestTable have?