1
Vote

System.ArgumentNullException in SQLStoreBase.GetPoolConnection()

description

I'm attempting to use the ORM with SQLite in a small full framework app but it was throwing the following exception when I attempted to do anything with the database.
System.ArgumentNullException was caught
  HResult=-2147467261
  Message=Value cannot be null.
Parameter name: method
  ParamName=method
  Source=mscorlib
  StackTrace:
       at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure)
       at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method)
       at OpenNETCF.ORM.SQLStoreBase`1.GetPoolConnection()
       at OpenNETCF.ORM.SQLStoreBase`1.GetConnection(Boolean maintenance, Boolean isRetry)
       at OpenNETCF.ORM.SQLStoreBase`1.GetConnection(Boolean maintenance)
       at OpenNETCF.ORM.SQLiteDataStore.<Select>d__e.MoveNext()
       at System.Linq.Enumerable.<CastIterator>d__94`1.MoveNext()
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at PieceCounterConduit.PieceCounterConduitDataContext.GetAppConfig() in c:\Users\craig_000\Documents\My Projects\PieceCounter\VS2013\PieceCounter\Conduit\PieceCounterConduit\PieceCounterConduitDataContext.cs:line 42
       at PcCntrConduitConfiguration.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\craig_000\Documents\My Projects\PieceCounter\VS2013\PieceCounter\Conduit\PcCntrConduitConfiguration\Configuration.vb:line 431
  InnerException: 
I tracked it down to the following line of code in OpenNETCF.ORM.SQLStoreBase returning null.
var target = this.GetType().GetMethod("ConnectionDisposed", BindingFlags.Instance | BindingFlags.NonPublic);
Changing the access modifier on the following method in OpenNETCF.ORM.SQLStoreBase from private to protected resolved the issue.
        private void ConnectionDisposed(object sender, EventArgs e)
        {
            var c = sender as IDbConnection;
            if (c != null)
            {
                m_connectionPool.Remove(c);
            }
        }
Thanks,
Craig

comments