diff options
-rw-r--r-- | tests/src/Interop/COM/NETClients/Primitives/Program.cs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/src/Interop/COM/NETClients/Primitives/Program.cs b/tests/src/Interop/COM/NETClients/Primitives/Program.cs index 4225cafdb3..0b58ef9278 100644 --- a/tests/src/Interop/COM/NETClients/Primitives/Program.cs +++ b/tests/src/Interop/COM/NETClients/Primitives/Program.cs @@ -5,6 +5,9 @@ namespace NetClient { using System; + using System.Threading; + using System.Runtime.InteropServices; + using TestLibrary; class Program { @@ -18,11 +21,12 @@ namespace NetClient try { - new NumericTests().Run(); - new ArrayTests().Run(); - new StringTests().Run(); - new ErrorTests().Run(); - new ColorTests().Run(); + RunTests(); + Console.WriteLine("Testing COM object lifetime control methods."); + Thread.CurrentThread.DisableComObjectEagerCleanup(); + RunTests(); + Marshal.CleanupUnusedObjectsInCurrentContext(); + Assert.IsFalse(Marshal.AreComObjectsAvailableForCleanup()); } catch (Exception e) { @@ -32,5 +36,14 @@ namespace NetClient return 100; } + + private static void RunTests() + { + new NumericTests().Run(); + new ArrayTests().Run(); + new StringTests().Run(); + new ErrorTests().Run(); + new ColorTests().Run(); + } } } |