2
Vote

ObjectDisposedException in SQLite for CF

description

First of all, I'm using the code compiled referencing the last version of System.Data.SQLite for CF (1.0.98.0) which uses SQLite 3.8.11.1

When trying to get a valid connection from the pool, ObjectDisposedException happens while trying to evaluate the State of the connections in the pool. Solved with this workaround:
foreach (var c in m_connectionPool.ToArray())
                    {
                        try {
                            if (c.State != ConnectionState.Executing && c.State != ConnectionState.Fetching) {
                                connection = c;
                                break;
                            }
                        }
                        catch (ObjectDisposedException) {
                            m_connectionPool.Remove(c);
                        }                        
                    }
But then, on the next Insert I'm receiving this exception:

Type: ArgumentException
Message: Transaction is not associated with the command's connection
Stack: en System.Data.SQLite.SQLiteCommand.set_Transaction(SQLiteTransaction value)
en OpenNETCF.ORM.SQLiteDataStore.OnInsert(Object item, Boolean insertReferences)
en OpenNETCF.ORM.DataStore1.Insert(Object item, Boolean insertReferences, Boolean recoveryInsert)
en OpenNETCF.ORM.DataStore
1.Insert(Object item, Boolean insertReferences)
en OpenNETCF.ORM.DataStore`1.Insert(Object item)

Don't know how to continue. For now I've rolled back to the previous version (also compiled with System.Data.SQLite 1.0.98.0)

comments