<Compile Include="System\Runtime\InteropServices\Marshal\BindToMonikerTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ChangeWrapperHandleStrengthTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\CleanupUnusedObjectsInCurrentContextTests.cs" />
- <Compile Include="System\Runtime\InteropServices\Marshal\Common\CommonTypes.cs" />
- <Compile Include="System\Runtime\InteropServices\Marshal\Common\CommonTypes.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="System\Runtime\InteropServices\Marshal\DestroyStructureTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\FreeBSTRTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\FreeCoTaskMemTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GenerateGuidForTypeTests.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="System\Runtime\InteropServices\Marshal\GenerateProgIdForTypeTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GenerateProgIdForTypeTests.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
+ <Compile Include="System\Runtime\InteropServices\Marshal\GetComObjectDataTests.cs" />
+ <Compile Include="System\Runtime\InteropServices\Marshal\GetComObjectDataTests.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
+ <Compile Include="System\Runtime\InteropServices\Marshal\GetDelegateForFunctionPointerTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GetExceptionCodeTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GetExceptionForHRTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GetExceptionPointersTests.cs" />
- <Compile Include="System\Runtime\InteropServices\Marshal\GetComObjectDataTests.cs" />
- <Compile Include="System\Runtime\InteropServices\Marshal\GetDelegateForFunctionPointerTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GetFunctionPointerForDelegateTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GetHINSTANCETests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\GetHRForExceptionTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\SecureStringToGlobalAllocAnsiTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\SecureStringToGlobalAllocUnicodeTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\SetComObjectDataTests.cs" />
+ <Compile Include="System\Runtime\InteropServices\Marshal\SetComObjectDataTests.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="System\Runtime\InteropServices\Marshal\SizeOfTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\StringToBSTRTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\StringToCoTaskMemAnsiTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ZeroFreeCoTaskMemUTF8Tests.cs" Condition="'$(TargetGroup)' == 'netcoreapp'" />
<Compile Include="System\Runtime\InteropServices\Marshal\ZeroFreeGlobalAllocAnsiTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ZeroFreeGlobalAllocUnicodeTests.cs" />
+ <Compile Include="System\Runtime\InteropServices\Marshal\Common\CommonTypes.cs" />
+ <Compile Include="System\Runtime\InteropServices\Marshal\Common\CommonTypes.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\ByteTests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\Int16Tests.cs" />
<Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\Int32Tests.cs" />
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Reflection;
using System.Reflection.Emit;
+using System.Runtime.InteropServices.Tests.Common;
using Xunit;
namespace System.Runtime.InteropServices.Tests
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not approved COM object for app")]
public partial class ComAwareEventInfoTests
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "ComEventsHelper.Combine throws a PNSE in .NET Core")]
- [ActiveIssue(31214)]
- public void AddEventHandler_DispIdAttribute_ThrowsPlatformNotSupportedException()
- {
- var attribute = new ComAwareEventInfo(typeof(DispAttributeInterface), nameof(DispAttributeInterface.Event));
- var target = new ComObject();
- Delegate handler = new EventHandler(EventHandler);
-
- Assert.Throws<PlatformNotSupportedException>(() => attribute.AddEventHandler(target, handler));
- Assert.Throws<PlatformNotSupportedException>(() => attribute.RemoveEventHandler(target, handler));
- }
-
[ComEventInterface(typeof(DispAttributeClass), typeof(int))]
public interface DispAttributeInterface
{
public void AddEventHandler_ComObjectWithoutComEventInterfaceAttribute_ThrowsInvalidOperationException()
{
var attribute = new ComAwareEventInfo(typeof(NonComObject), nameof(NonComObject.Event));
- var target = new ComObject();
+ var target = new ComImportObject();
Delegate handler = new EventHandler(EventHandler);
Assert.Throws<InvalidOperationException>(() => attribute.AddEventHandler(target, handler));
eventBuilder.SetAddOnMethod(addMethod);
var attribute = new ComAwareEventInfo(typeBuilder.CreateType(), "Event");
- var target = new ComObject();
+ var target = new ComImportObject();
Delegate handler = new EventHandler(EventHandler);
Assert.Throws<AmbiguousMatchException>(() => attribute.AddEventHandler(target, handler));
Assert.Throws<AmbiguousMatchException>(() => attribute.RemoveEventHandler(target, handler));
public void AddEventHandler_NullSourceTypeEventInterface_ThrowsNullReferenceException()
{
var attribute = new ComAwareEventInfo(typeof(NullSourceType), nameof(NullSourceType.Event));
- var target = new ComObject();
+ var target = new ComImportObject();
Delegate handler = new EventHandler(EventHandler);
Assert.Throws<NullReferenceException>(() => attribute.AddEventHandler(target, handler));
public void AddEventHandler_NoSuchSourceTypeEventInterface_ThrowsArgumentNullException()
{
var attribute = new ComAwareEventInfo(typeof(NoSuchSourceType), nameof(NoSuchSourceType.Event));
- var target = new ComObject();
+ var target = new ComImportObject();
Delegate handler = new EventHandler(EventHandler);
AssertExtensions.Throws<ArgumentNullException>("element", () => attribute.AddEventHandler(target, handler));
public void AddEventHandler_NoDispIdAttribute_ThrowsInvalidOperationException()
{
var attribute = new ComAwareEventInfo(typeof(NoDispAttributeInterface), nameof(NoDispAttributeInterface.Event));
- var target = new ComObject();
+ var target = new ComImportObject();
Delegate handler = new EventHandler(EventHandler);
Assert.Throws<InvalidOperationException>(() => attribute.AddEventHandler(target, handler));
Assert.Throws<InvalidOperationException>(() => attribute.RemoveEventHandler(target, handler));
}
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+ public void AddEventHandler_TargetNotIConnectionIConnectionPointContainer_ThrowsInvalidCastException()
+ {
+ var attribute = new ComAwareEventInfo(typeof(DispAttributeInterface), nameof(DispAttributeInterface.Event));
+ var target = new ComImportObject();
+ Delegate handler = new EventHandler(EventHandler);
+
+ Assert.Throws<InvalidCastException>(() => attribute.AddEventHandler(target, handler));
+ attribute.RemoveEventHandler(target, handler);
+ }
+
[ComEventInterface(typeof(NoDispAttributeClass), typeof(int))]
public interface NoDispAttributeInterface
{
{
public void Event() { }
}
-
- [ComImport]
- [Guid("7b9e38b0-a97c-11d0-8534-00c04fd8d503")]
- public class ComObject { }
}
#pragma warning restore 0618
}
public class ComEventsHelperTests
{
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)]
- [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Throws PlatformNotSupportedException in UapAot")]
- public void Combine_NullRcwWindows_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>(null, () => ComEventsHelper.Combine(null, Guid.Empty, 1, null));
- }
-
- [Fact]
[SkipOnTargetFramework(~TargetFrameworkMonikers.UapAot, "Throws PlatformNotSupportedException in UapAot")]
- public void Combine_NullRcwUapAot_PlatformNotSupportedException()
+ public void Combine_UapAot_PlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => ComEventsHelper.Combine(null, Guid.Empty, 1, null));
}
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)]
- public void Combine_NullRcwUnix_ThrowsArgumentNullException()
+ public void Combine_Unix_ThrowsPlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => ComEventsHelper.Combine(null, Guid.Empty, 1, null));
}
[Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "ComEventsHelper.Combine is not supported in .NET Core.")]
- [ActiveIssue(31214)]
- public void Combine_NonNullRcw_ThrowsPlatformNotSupportedException()
+ [PlatformSpecific(TestPlatforms.Windows)]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Throws PlatformNotSupportedException in UapAot")]
+ public void Combine_NullRcw_ThrowsArgumentNullException()
{
- Assert.Throws<PlatformNotSupportedException>(() => ComEventsHelper.Combine(1, Guid.Empty, 1, null));
+ AssertExtensions.Throws<ArgumentNullException>(null, () => ComEventsHelper.Combine(null, Guid.Empty, 1, null));
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Throws PlatformNotSupportedException in UapAot")]
- public void Remove_NullRcwWindows_ThrowsArgumentNullException()
+ public void Combine_NotComObject_ThrowsArgumentException()
{
- AssertExtensions.Throws<ArgumentNullException>(null, () => ComEventsHelper.Remove(null, Guid.Empty, 1, null));
+ AssertExtensions.Throws<ArgumentException>("obj", () => ComEventsHelper.Combine(1, Guid.Empty, 1, null));
}
[SkipOnTargetFramework(~TargetFrameworkMonikers.UapAot, "Throws PlatformNotSupportedException in UapAot")]
- public void Remove_NullRcwUapAot_ThrowsPlatformNotSupportedException()
+ public void Remove_UapAot_ThrowsPlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => ComEventsHelper.Remove(null, Guid.Empty, 1, null));
}
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)]
- public void Remove_NullRcwUnix_ThrowPlatformNotSupportedException()
+ public void Remove_Unix_ThrowPlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => ComEventsHelper.Remove(null, Guid.Empty, 1, null));
}
[Fact]
+ [PlatformSpecific(TestPlatforms.Windows)]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Throws PlatformNotSupportedException in UapAot")]
+ public void Remove_NullRcw_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>(null, () => ComEventsHelper.Remove(null, Guid.Empty, 1, null));
+ }
+
+ [Fact]
+ [PlatformSpecific(TestPlatforms.Windows)]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "ComEventsHelper.Combine is not supported in .NET Core.")]
- [ActiveIssue(31214)]
- public void Remove_NonNullRcw_ThrowsPlatformNotSupportedException()
+ public void Remove_NotComObject_ThrowsArgumentException()
{
- Assert.Throws<PlatformNotSupportedException>(() => ComEventsHelper.Remove(1, Guid.Empty, 1, null));
+ AssertExtensions.Throws<ArgumentException>("obj", () => ComEventsHelper.Remove(1, Guid.Empty, 1, null));
}
}
#pragma warning restore 0618
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#pragma warning disable CS0618 // Type or member is obsolete
+
namespace System.Runtime.InteropServices.Tests.Common
{
[ComImport]
[Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
public interface IComImportObject { }
+ [ComImport]
+ [Guid("BF46F910-6B9B-4FBF-BC81-87CDACD2BD83")]
+ [InterfaceType(ComInterfaceType.InterfaceIsDual)]
+ public interface DualInterface { }
+
+ [ComImport]
+ [Guid("8DCD4DCE-778A-4261-A812-F4595C2F2614")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IUnknownInterface { }
+
+ [ComImport]
+ [Guid("9323D453-BA36-4459-92AA-ECEC2F916FED")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
+ public interface IDispatchInterface { }
+
+ [ComImport]
+ [Guid("E7AA81A5-36A2-4CEC-A629-13B6A26865D1")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIInspectable)]
+ public interface IInspectableInterface { }
+
public class InterfaceComImportObject : IComImportObject { }
[ComImport]
[Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
public class ComImportObject { }
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.None)]
+ public class DualComObject : DualInterface { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.None)]
+ public class IUnknownComObject : IUnknownInterface { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.None)]
+ public class IDispatchComObject : IDispatchInterface { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.None)]
+ public class IInspectableComObject : IInspectableInterface { }
+
public class SubComImportObject : ComImportObject { }
+
+ public class GenericSubComImportObject<T> : ComImportObject { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.None)]
+ public class NonDualComObject : IComImportObject { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.None)]
+ public class NonDualComObjectEmpty { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ public class AutoDispatchComObject : IComImportObject { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ public class AutoDispatchComObjectEmpty { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ public class AutoDualComObject : IComImportObject { }
+
+ [ComImport]
+ [Guid("927971f5-0939-11d1-8be1-00c04fd8d503")]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ public class AutoDualComObjectEmpty { }
}
+
+#pragma warning restore CS0618 // Type or member is obsolete
[ComVisible(true)]
public interface NonGenericInterface { }
+
+ [ComVisible(false)]
+ public interface NonComVisibleInterface { }
+
+ [ComVisible(false)]
+ public class NonComVisibleClass { }
+
+ [ComVisible(false)]
+ public struct NonComVisibleStruct { }
}
--- /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 System.Runtime.InteropServices.Tests.Common;
+using Xunit;
+
+namespace System.Runtime.InteropServices.Tests
+{
+ public partial class GetComObjectDataTests
+ {
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+ [PlatformSpecific(TestPlatforms.Windows)]
+ public void GetComObjectData_ValidObject_ReturnsExpected()
+ {
+ var comObject = new ComImportObject();
+
+ Assert.Null(Marshal.GetComObjectData(comObject, "key"));
+
+ Marshal.SetComObjectData(comObject, "key", 1);
+ Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
+ Assert.Null(Marshal.GetComObjectData(comObject, "noSuchKey"));
+ }
+ }
+}
namespace System.Runtime.InteropServices.Tests
{
- public class GetComObjectDataTests
+ public partial class GetComObjectDataTests
{
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.GetComObjectData is not implemented in .NET Core.")]
- public void GetComObjectData_NetFramework_ReturnsExpected()
- {
- Type type = Type.GetTypeFromCLSID(new Guid("927971f5-0939-11d1-8be1-00c04fd8d503"));
- object comObject = Activator.CreateInstance(type);
-
- Assert.Null(Marshal.GetComObjectData(comObject, "key"));
- Marshal.SetComObjectData(comObject, "key", 1);
- Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
- Assert.Null(Marshal.GetComObjectData(comObject, "noSuchKey"));
- }
-
- [Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Marshal.GetComObjectData is not implemented in .NET Core.")]
- [ActiveIssue(31214)]
- public void GetComObjectData_NetCore_ThrowsPlatformNotSupportedException()
+ [PlatformSpecific(TestPlatforms.AnyUnix)]
+ public void GetComObjectData_Unix_ThrowsPlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => Marshal.GetComObjectData(null, null));
}
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.GetComObjectData is not implemented in .NET Core.")]
+ [PlatformSpecific(TestPlatforms.Windows)]
public void GetComObjectData_NullObj_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("obj", () => Marshal.GetComObjectData(null, new object()));
}
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.GetComObjectData is not implemented in .NET Core.")]
+ [PlatformSpecific(TestPlatforms.Windows)]
public void GetComObjectData_NullKey_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("key", () => Marshal.GetComObjectData(new object(), null));
}
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.GetComObjectData is not implemented in .NET Core.")]
+ [PlatformSpecific(TestPlatforms.Windows)]
public void GetComObjectData_NonComObjectObj_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentException>("obj", () => Marshal.GetComObjectData(1, 2));
--- /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 System.Runtime.InteropServices.Tests.Common;
+using Xunit;
+
+namespace System.Runtime.InteropServices.Tests
+{
+ public partial class SetComObjectDataTests
+ {
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+ [PlatformSpecific(TestPlatforms.Windows)]
+ public void SetComObjectData_NonNullValue_Sucesss()
+ {
+ var comObject = new ComImportObject();
+
+ Assert.True(Marshal.SetComObjectData(comObject, "key", 1));
+ Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
+
+ Assert.False(Marshal.SetComObjectData(comObject, "key", 2));
+ Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
+
+ Assert.True(Marshal.SetComObjectData(comObject, "otherKey", 2));
+ Assert.Equal(2, Marshal.GetComObjectData(comObject, "otherKey"));
+ }
+
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+ [PlatformSpecific(TestPlatforms.Windows)]
+ public void SetComObjectData_NullValue_Sucesss()
+ {
+ var comObject = new ComImportObject();
+
+ Assert.True(Marshal.SetComObjectData(comObject, "key", null));
+ Assert.Null(Marshal.GetComObjectData(comObject, "key"));
+
+ Assert.True(Marshal.SetComObjectData(comObject, "key", null));
+ Assert.Null(Marshal.GetComObjectData(comObject, "key"));
+
+ Assert.True(Marshal.SetComObjectData(comObject, "key", 1));
+ Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
+
+ Assert.True(Marshal.SetComObjectData(comObject, "otherKey", null));
+ Assert.Null(Marshal.GetComObjectData(comObject, "otherKey"));
+ }
+ }
+}
namespace System.Runtime.InteropServices.Tests
{
- public class SetComObjectDataTests
+ public partial class SetComObjectDataTests
{
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.SetComObjectData is not implemented in .NET Core.")]
- public void SetComObjectData_NetFramework_ReturnsExpected()
- {
- Type type = Type.GetTypeFromCLSID(new Guid("927971f5-0939-11d1-8be1-00c04fd8d503"));
- object comObject = Activator.CreateInstance(type);
-
- Assert.True(Marshal.SetComObjectData(comObject, "key", 1));
- Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
-
- Assert.False(Marshal.SetComObjectData(comObject, "key", 2));
- Assert.Equal(1, Marshal.GetComObjectData(comObject, "key"));
-
- Assert.True(Marshal.SetComObjectData(comObject, "otherKey", 2));
- Assert.Equal(2, Marshal.GetComObjectData(comObject, "otherKey"));
- }
-
- [Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Marshal.SetComObjectData is not implemented in .NET Core.")]
- [ActiveIssue(31214)]
- public void SetComObjectData_NetCore_ThrowsPlatformNotSupportedException()
+ [PlatformSpecific(TestPlatforms.AnyUnix)]
+ public void SetComObjectData_Unix_ThrowsPlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => Marshal.SetComObjectData(null, null, null));
}
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.SetComObjectData is not implemented in .NET Core.")]
+ [PlatformSpecific(TestPlatforms.Windows)]
public void SetComObjectData_NullObj_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("obj", () => Marshal.SetComObjectData(null, new object(), 3));
}
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.SetComObjectData is not implemented in .NET Core.")]
+ [PlatformSpecific(TestPlatforms.Windows)]
public void SetComObjectData_NullKey_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("key", () => Marshal.SetComObjectData(new object(), null, 3));
}
[Fact]
- [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.SetComObjectData is not implemented in .NET Core.")]
+ [PlatformSpecific(TestPlatforms.Windows)]
public void SetComObjectData_NonComObjectObj_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentException>("obj", () => Marshal.SetComObjectData(1, 2, 3));