summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jekoritz@microsoft.com>2019-06-06 14:39:42 -0700
committerGitHub <noreply@github.com>2019-06-06 14:39:42 -0700
commit2e9cd827b0db60ad42f7df1f34ee1fada1951e5f (patch)
treeba746adde029694ee2eb5af58ab52c73e5faf2fe
parenta0486f5970ed63a7e7fb987f9a22fc8349574505 (diff)
downloadcoreclr-2e9cd827b0db60ad42f7df1f34ee1fada1951e5f.tar.gz
coreclr-2e9cd827b0db60ad42f7df1f34ee1fada1951e5f.tar.bz2
coreclr-2e9cd827b0db60ad42f7df1f34ee1fada1951e5f.zip
Move COM object lifetime control tests to CoreCLR. (#24990)
* Add COM object lifetime control tests to CoreCLR. * Combine cleanup control test into NETClientPrimitives.
-rw-r--r--tests/src/Interop/COM/NETClients/Primitives/Program.cs23
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();
+ }
}
}