List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:July 26 2010 4:30pm
Subject:bzr commit into connector-net-6.2 branch (vvaintroub:875) Bug#55558
View as plain text  
#At file:///H:/connector_net/6.2/ based on revid:vvaintroub@stripped

  875 Vladislav Vaintroub	2010-07-26
      Bug#55558 : ensure that connection.Reader is always reset to null  in DataReader.Close(), also in case of
      exceptions.
      
      Aso,eat IOExceptions in Close() the same way as we handlle IOExceptions wrapped into MySqlException

    modified:
      CHANGES
      MySql.Data/Provider/Source/datareader.cs
=== modified file 'CHANGES'
--- a/CHANGES	2010-07-19 19:38:52 +0000
+++ b/CHANGES	2010-07-26 16:30:20 +0000
@@ -1,3 +1,5 @@
+- fix "There is already an open DataReader..." after exceptions in DataReader.Close()
+ (bug#55558)
 - Fix membership provider creation failure, when default database character set is different from latin1 (Bug #53174)
 - Fix "Connection must be valid and open" exception When UpdateBatchSize > 1 
   and MySqlDataAdapter is not using an open connection (Bug #38411)

=== modified file 'MySql.Data/Provider/Source/datareader.cs'
--- a/MySql.Data/Provider/Source/datareader.cs	2010-07-08 21:02:47 +0000
+++ b/MySql.Data/Provider/Source/datareader.cs	2010-07-26 16:30:20 +0000
@@ -185,12 +185,12 @@ namespace MySql.Data.MySqlClient
             // clear all remaining resultsets
             try
             {
-              while (NextResult()) { }
+                while (NextResult()) { }
             }
             catch (MySqlException ex)
             {
                 // Ignore aborted queries
-                if (!ex.IsQueryAborted)
+                if (ex.IsQueryAborted)
                 {
                     // ignore IO exceptions.
                     // We are closing or disposing reader, and  do not
@@ -215,8 +215,16 @@ namespace MySql.Data.MySqlClient
                     }
                 }
             }
-
-            connection.Reader = null;
+            catch (System.IO.IOException)
+            {
+                // eat, on the same reason we eat IO exceptions wrapped into 
+                // MySqlExceptions reasons, described above.
+            }
+            finally
+            {
+                // always ensure internal reader is null (Bug #55558)
+                connection.Reader = null;
+            }
             // we now give the command a chance to terminate.  In the case of
 			// stored procedures it needs to update out and inout parameters
 			command.Close(this);


Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20100726163020-oyspgj7tzuvfz0nn.bundle
Thread
bzr commit into connector-net-6.2 branch (vvaintroub:875) Bug#55558Vladislav Vaintroub26 Jul