Hello,
I am getting System.AccessViolationException when reading from instance of SQLiteDataReader passed to another class.
Here is the situation:
I have a class called TrustedApp and a static class TrustedAppsDal. I'm creating an instance of TrustedApp class and calling its GetAll method which in turn calls TrustedAppsDal's static GetAll function. TrustedAppsDal's static GetAll function returns instance of SQLiteDataReader to GetAll method of TrsutedApp class. When invoking GetInt64() method I'm getting System.AccessViolationException. I'm getting same exception when calling any other Getxxx() method. However, invoking these methods in the static GetAll function works as expected.
Any ideas?
I know that I shouldn't be passing instance of SQLiteDataReader between threads (and I'm not) but documentation doesn't say anything about passing between classes.
Here is stacktrace:
at System.Data.SQLite.UnsafeNativeMethods.sqlite3_column_type_interop(IntPtr stmt, Int32 index)
at System.Data.SQLite.SQLite3.ColumnAffinity(SQLiteStatement stmt, Int32 index)
at System.Data.SQLite.SQLite3.ColumnType(SQLiteStatement stmt, Int32 index, TypeAffinity& nAffinity)
at System.Data.SQLite.SQLiteDataReader.GetSQLiteType(Int32 i)
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
at System.Data.SQLite.SQLiteDataReader.GetInt64(Int32 i)