<Compile Include="System\Runtime\InteropServices\Marshal\Copy\SingleArrayTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\AddRefTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\AllocHGlobalTests.cs" />
- <Compile Include="System\Runtime\InteropServices\Marshal\AreComObjectsAvailableForCleanupTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\BindToMonikerTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ChangeWrapperHandleStrengthTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ChangeWrapperHandleStrengthTests.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
- <Compile Include="System\Runtime\InteropServices\Marshal\CleanupUnusedObjectsInCurrentContextTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\CreateAggregatedObjectTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\CreateWrapperOfTypeTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\CreateWrapperOfTypeTests.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Xunit;
-
-namespace System.Runtime.InteropServices.Tests
-{
- public class AreComObjectsAvailableForCleanupTests
- {
- [Fact]
- public void AreComObjectsAvailableForCleanup_NothingToCleanup_ReturnsFalse()
- {
- Assert.False(Marshal.AreComObjectsAvailableForCleanup());
- }
- }
-}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Xunit;
-
-namespace System.Runtime.InteropServices.Tests
-{
- public class CleanupUnusedObjectsInCurrentContextTests
- {
- [Fact]
- public void CleanupUnusedObjectsInCurrentContext_InvokeSeveralTimes_Success()
- {
- Marshal.CleanupUnusedObjectsInCurrentContext();
- Assert.False(Marshal.AreComObjectsAvailableForCleanup());
-
- // Invoke twice to make sure things work when unused objects have already been
- // cleaned up and there is nothing to do.
- Marshal.CleanupUnusedObjectsInCurrentContext();
- Assert.False(Marshal.AreComObjectsAvailableForCleanup());
- }
- }
-}
Thread.BeginThreadAffinity();
Thread.EndThreadAffinity();
- ThreadTestHelpers.RunTestInBackgroundThread(() =>
- {
- // TODO: Port tests for these once all of the necessary interop APIs are available
- Thread.CurrentThread.DisableComObjectEagerCleanup();
- Marshal.CleanupUnusedObjectsInCurrentContext();
- });
-
#pragma warning disable 618 // obsolete members
Assert.Throws<InvalidOperationException>(() => Thread.CurrentThread.GetCompressedStack());
Assert.Throws<InvalidOperationException>(() => Thread.CurrentThread.SetCompressedStack(CompressedStack.Capture()));