System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 3aa50d841339abce404a0ce409392f3130f25295
Title: SQLiteDataAdapter.FillSchema throws NullReferenceException with multiple result sets
Status: Closed Type: Code_Defect
Severity: Important Priority: Blocker
Subsystem: Data_Reader Resolution: Fixed
Last Modified: 2012-05-25 23:36:45
Version Found In: 1.0.80.0
Description:
This issue was reported on the mailing list.

The root cause was a reentrancy issue where the _keyInfo field of the SQLiteDataReader was disposed just prior to being recreated; however, it was not subsequently set to null. Then, the GetSchemaTable method was invoked indirectly via the SQLiteKeyReader constructor, causing the code to call the AppendSchemaTable method on the disposed SQLiteKeyReader instance.


mistachkin added on 2012-05-25 23:28:56 UTC:
Fixed on trunk by check-in [b0c9d60ac7].


mistachkin added on 2012-05-25 23:36:18 UTC:
For future reference, the stack trace for this issue looks something like this:

System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Data.SQLite.SQLiteKeyReader.AppendSchemaTable(DataTable tbl) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteKeyReader.cs:line 604
   at System.Data.SQLite.SQLiteDataReader.GetSchemaTable(Boolean wantUniqueInfo, Boolean wantDefaultValue) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteDataReader.cs:line 1008
   at System.Data.SQLite.SQLiteKeyReader..ctor(SQLiteConnection cnn, SQLiteDataReader reader, SQLiteStatement stmt) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteKeyReader.cs:line 172
   at System.Data.SQLite.SQLiteDataReader.LoadKeyInfo() in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteDataReader.cs:line 1319
   at System.Data.SQLite.SQLiteDataReader.NextResult() in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteDataReader.cs:line 1218
   at System.Data.Common.DataAdapter.FillSchemaFromReader(DataSet dataset, DataTable datatable, SchemaType schemaType, String srcTable, IDataReader dataReader)
   at System.Data.Common.DataAdapter.FillSchema(DataSet dataSet, SchemaType schemaType, String srcTable, IDataReader dataReader)
   at System.Data.Common.DbDataAdapter.FillSchemaInternal(DataSet dataset, DataTable datatable, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillSchema(DataSet dataSet, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillSchema(DataSet dataSet, SchemaType schemaType)
   at _Dynamic16144.Test16144.Main()