MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:August 6 2010 10:30am
Subject:bzr commit into connector-net-6.1 branch (vvaintroub:840) Bug#55793
View as plain text  
#At file:///H:/connector_net/6.1/ based on revid:vvaintroub@stripped

  840 Vladislav Vaintroub	2010-08-06
      Bug#55793: dispose EventLog in SessionState provider

    modified:
      MySql.Web/Providers/Source/SessionProvider.cs
=== modified file 'MySql.Web/Providers/Source/SessionProvider.cs'
--- a/MySql.Web/Providers/Source/SessionProvider.cs	2010-08-03 21:22:30 +0000
+++ b/MySql.Web/Providers/Source/SessionProvider.cs	2010-08-06 10:30:32 +0000
@@ -94,14 +94,16 @@ namespace MySql.Web.SessionState
         {
             if (WriteExceptionsToEventLog)
             {
-                EventLog log = new EventLog();
-                log.Source = eventSource;
-                log.Log = eventLog;
-
-                string message = "An exception occurred communicating with the data source.\n\n";
-                message += "Action: " + action;
-                message += "Exception: " + e.ToString();
-                log.WriteEntry(message);
+                using (EventLog log = new EventLog())
+                {
+                    log.Source = eventSource;
+                    log.Log = eventLog;
+
+                    string message = "An exception occurred communicating with the data source.\n\n";
+                    message += "Action: " + action;
+                    message += "Exception: " + e.ToString();
+                    log.WriteEntry(message);
+                }
             }
             throw new ProviderException(exceptionMessage, e);
         }
@@ -734,10 +736,12 @@ namespace MySql.Web.SessionState
                                  "to improve performance,e.g with 'alter table my_aspnet_Sessions engine innodb'\n";
                             try
                             {
-                                EventLog log = new EventLog();
-                                log.Source = eventSource;
-                                log.Log = eventLog;
-                                log.WriteEntry(message);
+                                using (EventLog log = new EventLog())
+                                {
+                                    log.Source = eventSource;
+                                    log.Log = eventLog;
+                                    log.WriteEntry(message);
+                                }
                             }
                             catch (SecurityException)
                             {


Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20100806103032-l2e6fn4t326f5ilf.bundle
Thread
bzr commit into connector-net-6.1 branch (vvaintroub:840) Bug#55793Vladislav Vaintroub6 Aug