From 143f6192b71bc035dcc8668d6b45833d683b216b Mon Sep 17 00:00:00 2001 From: Nickolay Batov Date: Sun, 17 Sep 2023 22:47:13 +0300 Subject: [PATCH 1/2] fix ExpectedSessionState6 call Signed-off-by: Nickolay Batov --- src/MySqlConnector/Core/ServerSession.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MySqlConnector/Core/ServerSession.cs b/src/MySqlConnector/Core/ServerSession.cs index 0b79453ec..133f4dcf0 100644 --- a/src/MySqlConnector/Core/ServerSession.cs +++ b/src/MySqlConnector/Core/ServerSession.cs @@ -1770,7 +1770,7 @@ private void VerifyState(State state1, State state2, State state3, State state4, { if (m_state != state1 && m_state != state2 && m_state != state3 && m_state != state4 && m_state != state5 && m_state != state6) { - ExpectedSessionState6(m_logger, Id, state1, state2, state3, state4, state5, state5, m_state); + ExpectedSessionState6(m_logger, Id, state1, state2, state3, state4, state5, state6, m_state); throw new InvalidOperationException($"Expected state to be ({state1}|{state2}|{state3}|{state4}|{state5}|{state6}) but was {m_state}."); } } From 3b99ed2db452d6fda4df21c35f63fa206b978abc Mon Sep 17 00:00:00 2001 From: Nickolay Batov Date: Sun, 17 Sep 2023 23:05:28 +0300 Subject: [PATCH 2/2] dispose X509Store Signed-off-by: Nickolay Batov --- src/MySqlConnector/Core/ServerSession.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MySqlConnector/Core/ServerSession.cs b/src/MySqlConnector/Core/ServerSession.cs index 133f4dcf0..2b82b2ee0 100644 --- a/src/MySqlConnector/Core/ServerSession.cs +++ b/src/MySqlConnector/Core/ServerSession.cs @@ -1291,7 +1291,7 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect try { var storeLocation = (cs.CertificateStoreLocation == MySqlCertificateStoreLocation.CurrentUser) ? StoreLocation.CurrentUser : StoreLocation.LocalMachine; - var store = new X509Store(StoreName.My, storeLocation); + using var store = new X509Store(StoreName.My, storeLocation); store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); if (cs.CertificateThumbprint.Length == 0)