Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-164

MongoConnectionPool - Object reference not set to instance of object

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      Windows 7 x64

      When closing a connection, getting "Object reference not set to instance of object". It's coming from MongoConnecitonPool.ReleaseConnection(MongoConnection connection):

      connection.LastUsedAt = DateTime.UtcNow;
      availableConnections.Add(connection);
      Monitor.Pulse(connectionPoolLock);

      Looks like this is getting called after the close method, which sets the availableConnections to null. I assume at this point that the connection is just being abandoned, and has already been close, I added an if statement to my code to make sure availableConnections wasn't null before adding it back to the pool. Not sure if that's the right answer.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            poindexter12 Joe Seymour
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: