title: Why call SqlClient.SqlDataReader Close() method anyway?
body: <p>Is the SqlClient.SqlDataReader a .NET managed object or not?
  Why do we have to call the Close() method explicitly close an open connection?
  Shouldn't running out of scope for such an object automatically close this?
  Shouldn't garbage collector clean it up anyway?</p>
  
  <p>Please help me understand what is the best practise here.</p>
  
  <p>I have seen a related question <a href="https://stackoverflow.com/questions/247311/sqldatareader-in-this-scenario-will-the-reader-get-closed">here</a> and it further illustrates the issue I have with a web application. The issue is that we were running out of connections. The detailed error is here:</p>
  
  <pre><code>Exception: System.InvalidOperationException
  Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
  Source: System.Data 
  
  at  System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean&amp; isInTransaction)
  at  System.Data.SqlClient.SqlConnection.Open()
  </code></pre>
  
  <p>To fix this, I had to explicitly close all the SQLDataReader objects.</p>
  
  <p>I am using .NET Framework 3.5</p>