diff --git a/MBBSEmu.Tests/Btrieve/BtrieveFileProcessor_Tests.cs b/MBBSEmu.Tests/Btrieve/BtrieveFileProcessor_Tests.cs index 0dde2187..e402e187 100644 --- a/MBBSEmu.Tests/Btrieve/BtrieveFileProcessor_Tests.cs +++ b/MBBSEmu.Tests/Btrieve/BtrieveFileProcessor_Tests.cs @@ -78,6 +78,8 @@ public BtrieveFileProcessor_Tests() public void Dispose() { + SqliteConnection.ClearAllPools(); + Directory.Delete(_modulePath, recursive: true); } diff --git a/MBBSEmu.Tests/DOS/BtrieveRuntime_Tests.cs b/MBBSEmu.Tests/DOS/BtrieveRuntime_Tests.cs index f139a44c..9d52b511 100644 --- a/MBBSEmu.Tests/DOS/BtrieveRuntime_Tests.cs +++ b/MBBSEmu.Tests/DOS/BtrieveRuntime_Tests.cs @@ -6,6 +6,7 @@ using MBBSEmu.DOS; using MBBSEmu.IO; using MBBSEmu.Resources; +using Microsoft.Data.Sqlite; using NLog; using System; using System.IO; @@ -33,6 +34,8 @@ public BtrieveRuntime_Tests() public void Dispose() { + SqliteConnection.ClearAllPools(); + Directory.Delete(_modulePath, recursive: true); } diff --git a/MBBSEmu.Tests/Integration/MBBSEmuIntegrationTestBase.cs b/MBBSEmu.Tests/Integration/MBBSEmuIntegrationTestBase.cs index 7dd6bd64..3aad8215 100644 --- a/MBBSEmu.Tests/Integration/MBBSEmuIntegrationTestBase.cs +++ b/MBBSEmu.Tests/Integration/MBBSEmuIntegrationTestBase.cs @@ -7,6 +7,7 @@ using MBBSEmu.Resources; using MBBSEmu.Session; using MBBSEmu.TextVariables; +using Microsoft.Data.Sqlite; using System; using System.Collections.Generic; using System.IO; @@ -35,6 +36,10 @@ public MBBSEmuIntegrationTestBase() public void Dispose() { + _serviceResolver.Dispose(); + + SqliteConnection.ClearAllPools(); + Directory.Delete(_modulePath, recursive: true); } diff --git a/MBBSEmu/Btrieve/BtrieveFileProcessor.cs b/MBBSEmu/Btrieve/BtrieveFileProcessor.cs index 377c646f..de514b72 100644 --- a/MBBSEmu/Btrieve/BtrieveFileProcessor.cs +++ b/MBBSEmu/Btrieve/BtrieveFileProcessor.cs @@ -128,6 +128,7 @@ public void Dispose() { cmd.Dispose(); } + _sqlCommands.Clear(); Connection.Close(); Connection.Dispose(); diff --git a/MBBSEmu/Btrieve/BtrieveQuery.cs b/MBBSEmu/Btrieve/BtrieveQuery.cs index 9886848b..e5c8db8a 100644 --- a/MBBSEmu/Btrieve/BtrieveQuery.cs +++ b/MBBSEmu/Btrieve/BtrieveQuery.cs @@ -23,6 +23,8 @@ public class SqliteReader : IDisposable public void Dispose() { DataReader?.Dispose(); + // Purposefully not Disposing of Command because it's likely cached by BtrieveFileProcessor, so let that class + // handle the cleanup } } diff --git a/MBBSEmu/MBBSEmu.csproj b/MBBSEmu/MBBSEmu.csproj index de00878a..0c36cf6a 100644 --- a/MBBSEmu/MBBSEmu.csproj +++ b/MBBSEmu/MBBSEmu.csproj @@ -74,7 +74,7 @@ - +