[Mono-bugs] [Bug 81710][Maj] New - SqlClient Command.Dispose closing connection

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 22 17:19:20 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by amc1999 at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81710

--- shadow/81710	2007-05-22 17:19:20.000000000 -0400
+++ shadow/81710.tmp.18513	2007-05-22 17:19:20.000000000 -0400
@@ -0,0 +1,62 @@
+Bug#: 81710
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.Data.SqlClient
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: amc1999 at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SqlClient Command.Dispose closing connection
+
+Description of Problem:
+in 1.2.4 call of SqlClient.SqlCommand.Dispose() will close db-connection:
+
+protected override void Dispose (bool disposing)
+{
+    if (!disposed) {
+        if (disposing) {
+            base.Dispose (disposing);
+            if (connection != null)
+                connection.Dispose ();
+            if (transaction != null)
+                transaction.Dispose ();
+            parameters.Clear ();
+        }
+        disposed = true;
+    }
+}
+
+Steps to reproduce the problem:
+
+1. open connection, create command, dispose command
+2. try to use connection and see an exception
+
+Expected Results:
+
+Keep connection open. Something like:
+protected override void Dispose (bool disposing)
+{
+    if (!disposed) {
+        if (disposing) {
+            parameters.Clear();
+            transaction = null;
+            connection = null;
+            base.Dispose(disposing);
+        }
+        disposed = true;
+    }
+}
+
+How often does this happen? 
+always
+
+Additional Information:
+SqlCommand.Dispose() also called indirectly through IDbDataAdapter.Dispose()


More information about the mono-bugs mailing list