Ticket Hash: | 84718e79fa5ecb0f8575382fe684fc3b02dfe672 | ||
Title: | Exception loading DataTable from SQLiteDataReader (threaded) | ||
Status: | Closed | Type: | Code_Defect |
Severity: | Critical | Priority: | Immediate |
Subsystem: | None | Resolution: | Fixed |
Last Modified: | 2011-10-15 10:15:44 | ||
Version Found In: | 1.0.76.0 |
Description: | ||||
Error happens when two threads try to execute the following code at the same time. Both queries can be simple SELECT * from query1table/query2table queries. My code hasn't changed, I only updated v1.0.74 to v1.0.76. I didn't encounter such exceptions using earlier version.
DataTable table = new DataTable(); using (SQLiteCommand cmd = _connection.CreateCommand()) { cmd.CommandText = query; using (SQLiteDataReader reader = cmd.ExecuteReader()) { table.Load(reader); reader.Close(); } } An item with the same key has already been added. mscorlib at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) at System.Data.SQLite.SQLiteConvert.TypeNameToDbType(String Name) at System.Data.SQLite.SQLiteDataReader.GetSQLiteType(Int32 i) at System.Data.SQLite.SQLiteDataReader.GetSchemaTable(Boolean wantUniqueInfo, Boolean wantDefaultValue) at System.Data.SQLite.SQLiteDataReader.GetSchemaTable() at System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.FillMappingInternal(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.Common.LoadAdapter.FillFromReader(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler) at System.Data.DataTable.Load(IDataReader reader) mistachkin added on 2011-10-15 10:15:44 UTC: |