Bug #26586 Possible missing inheritance of IDisposable by MySqlConnection
Submitted: 23 Feb 2007 1:24 Modified: 27 Feb 2007 19:57
Reporter: Simon Gregory Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.03 OS:Windows (Windows XP Pro)
Assigned to: CPU Architecture:Any
Tags: Connection, Leak

[23 Feb 2007 1:24] Simon Gregory
Description:
API like ExecuteNonQuery allow the passing of a connection string and create a connection implicitly, by use of:

using (MySqlConnection cn = new MySqlConnection(connectionString))
{
    ... do work ....
}

They rely on the connection being closed as it goes out of scope by the automatic driving of the MySqlConnection.Dispose() method.

But the connection class seems to be declared as:

public sealed class MySqlConnection : DbConnection, ICloneable

I "think" this will result in connections not be destroyed / returned to pool for helper methods other than ExecuteReader that using connection string inputs.

How to repeat:
N/a

Suggested fix:
public sealed class MySqlConnection : DbConnection, ICloneable, IDisposable
[23 Feb 2007 1:26] Simon Gregory
Oops - blow this away - it's included from the DbConnection class.