Fix build break caused by conflicting changes
authorJan Kotas <jkotas@microsoft.com>
Sat, 1 Sep 2018 16:47:13 +0000 (09:47 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 1 Sep 2018 22:06:46 +0000 (15:06 -0700)
Ifdef use of Reflection.Emit for netstandard build of System.Runtime.InteropServices tests. I choose to ifdef it out instead of
refactoring into small files since this change is temporary. These ifdefs should be removed once Reflection.Emit is added to netstandard2.1.

Commit migrated from https://github.com/dotnet/corefx/commit/83cc1fe1dd028261bfed42b634bdab51e651c050

25 files changed:
src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ChangeWrapperHandleStrengthTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/DestroyStructureTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GenerateGuidForTypeTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GenerateProgIdForTypeTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetIDispatchForObjectTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetNativeVariantForObjectTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetTypedObjectForIUnknownTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/IsComObjectTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/PtrToStructureTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/ByteTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/ByteTests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int16Tests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int16Tests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int32Tests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int32Tests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int64Tests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int64Tests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/IntPtrTests.cs
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/IntPtrTests.nonnetstandard.cs [deleted file]
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs

index f0e0461..7171540 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <ProjectGuid>{A824F4CD-935B-4496-A1B2-C3664936DA7B}</ProjectGuid>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <Compile Include="System\Runtime\InteropServices\Marshal\GenerateGuidForTypeTests.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\GenerateProgIdForTypeTests.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\GetComObjectDataTests.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\GetDelegateForFunctionPointerTests.nonnetstandard.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\GetExceptionPointersTests.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\GetFunctionPointerForDelegateTests.nonnetstandard.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\GetHINSTANCETests.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\GetIDispatchForObjectTests.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\GetTypedObjectForIUnknownTests.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\ByteTests.nonnetstandard.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\Int16Tests.nonnetstandard.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\Int32Tests.nonnetstandard.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\Int64Tests.nonnetstandard.cs" />
-    <Compile Include="System\Runtime\InteropServices\Marshal\ReadWrite\IntPtrTests.nonnetstandard.cs" />
     <Compile Include="System\Runtime\InteropServices\Marshal\SetComObjectDataTests.cs" />
     <Compile Include="System\Runtime\InteropServices\TypeLibFuncAttributeTests.cs" />
     <Compile Include="System\Runtime\InteropServices\TypeLibImportClassAttributeTests.cs" />
index a7c2382..d129aa5 100644 (file)
@@ -51,6 +51,7 @@ namespace System.Runtime.InteropServices.Tests
             AssertExtensions.Throws<ArgumentNullException>("otp", () => Marshal.ChangeWrapperHandleStrength(null, fIsWeak: false));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNative))]
         [PlatformSpecific(TestPlatforms.Windows)]
         public void ChangeWrapperHandleStrength_ObjectNotCollectible_ThrowsNotSupportedException()
@@ -63,6 +64,7 @@ namespace System.Runtime.InteropServices.Tests
             object o = Activator.CreateInstance(type);
             Assert.Throws<NotSupportedException>(() => Marshal.ChangeWrapperHandleStrength(o, fIsWeak: true));
         }
+#endif
 
         [Fact]
         [PlatformSpecific(TestPlatforms.AnyUnix)]
index f547d54..f3c225c 100644 (file)
@@ -85,10 +85,12 @@ namespace System.Runtime.InteropServices.Tests
 
             yield return new object[] { typeof(GenericClass<>).GetTypeInfo().GenericTypeParameters[0] };
 
+#if !netstandard // TODO: Enable for netstandard2.1
             AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.Run);
             ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
             yield return new object[] { typeBuilder };
+#endif
         }
 
         [Theory]
index 49d39b9..a60edfc 100644 (file)
@@ -43,11 +43,13 @@ namespace System.Runtime.InteropServices.Tests
 
             yield return new object[] { typeof(ClassWithGuidAttribute) };
 
+#if !netstandard // TODO: Enable for netstandard2.1
             AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
             ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
             Type collectibleType = typeBuilder.CreateType();
             yield return new object[] { collectibleType };
+#endif
         }
 
         [Theory]
index e5048f7..0b0cbc1 100644 (file)
@@ -61,11 +61,13 @@ namespace System.Runtime.InteropServices.Tests
             yield return new object[] { typeof(GenericClass<>) };
             yield return new object[] { typeof(GenericClass<>).GetTypeInfo().GenericTypeParameters[0] };
 
+#if !netstandard // TODO: Enable for netstandard2.1
             AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
             ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
             Type collectibleType = typeBuilder.CreateType();
             yield return new object[] { collectibleType };
+#endif
         }
 
         [Theory]
index 7580b44..c9adefc 100644 (file)
@@ -11,7 +11,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class GetDelegateForFunctionPointerTests
+    public class GetDelegateForFunctionPointerTests
     {
         [Theory]
         [InlineData(typeof(NonGenericDelegate))]
@@ -28,6 +28,31 @@ namespace System.Runtime.InteropServices.Tests
             VerifyDelegate(functionDelegate, targetMethod);
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void GetDelegateForFunctionPointer_CollectibleType_ReturnsExpected()
+        {
+            MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method));
+            Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate));
+            IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d);
+
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type", TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.AutoClass, typeof(MulticastDelegate));
+            ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(object), typeof(IntPtr) });
+            constructorBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
+
+            MethodBuilder methodBuilder = typeBuilder.DefineMethod("Invoke", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, targetMethod.ReturnType, targetMethod.GetParameters().Select(p => p.ParameterType).ToArray());
+            methodBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
+
+            Type type = typeBuilder.CreateType();
+
+            Delegate functionDelegate = Marshal.GetDelegateForFunctionPointer(ptr, type);
+            GC.KeepAlive(d);
+            VerifyDelegate(functionDelegate, targetMethod);
+        }
+#endif
+
         [Fact]
         public void GetDelegateForFunctionPointer_Generic_ReturnsExpected()
         {
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.nonnetstandard.cs
deleted file mode 100644 (file)
index 6659c8b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Reflection.Emit;
-using System.Runtime.InteropServices.Tests.Common;
-using Xunit;
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class GetDelegateForFunctionPointerTests
-    {
-        [Fact]
-        public void GetDelegateForFunctionPointer_CollectibleType_ReturnsExpected()
-        {
-            MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method));
-            Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate));
-            IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d);
-
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type", TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.AutoClass, typeof(MulticastDelegate));
-            ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(object), typeof(IntPtr) });
-            constructorBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
-
-            MethodBuilder methodBuilder = typeBuilder.DefineMethod("Invoke", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, targetMethod.ReturnType, targetMethod.GetParameters().Select(p => p.ParameterType).ToArray());
-            methodBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
-
-            Type type = typeBuilder.CreateType();
-
-            Delegate functionDelegate = Marshal.GetDelegateForFunctionPointer(ptr, type);
-            GC.KeepAlive(d);
-            VerifyDelegate(functionDelegate, targetMethod);
-        }
-    }
-}
index 9cd7a81..c862a66 100644 (file)
@@ -9,7 +9,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class GetFunctionPointerForDelegateTests
+    public class GetFunctionPointerForDelegateTests
     {
         [Fact]
         public void GetFunctionPointerForDelegate_NormalDelegateNonGeneric_ReturnsExpected()
@@ -88,6 +88,28 @@ namespace System.Runtime.InteropServices.Tests
             AssertExtensions.Throws<ArgumentException>("delegate", () => Marshal.GetFunctionPointerForDelegate(d));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void GetFunctionPointerForDelegate_DelegateCollectible_ThrowsNotSupportedException()
+        {
+            MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method));
+
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type", TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.AutoClass, typeof(MulticastDelegate));
+            ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(object), typeof(IntPtr) });
+            constructorBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
+
+            MethodBuilder methodBuilder = typeBuilder.DefineMethod("Invoke", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, targetMethod.ReturnType, targetMethod.GetParameters().Select(p => p.ParameterType).ToArray());
+            methodBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
+
+            Type type = typeBuilder.CreateType();
+
+            Delegate d = targetMethod.CreateDelegate(type);
+            Assert.Throws<NotSupportedException>(() => Marshal.GetFunctionPointerForDelegate(d));
+        }
+#endif
+
         public delegate void GenericDelegate<T>(T t);
         public delegate void NonGenericDelegate(string t);
 
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.nonnetstandard.cs
deleted file mode 100644 (file)
index 5a0aaea..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.Linq;
-using System.Reflection;
-using System.Reflection.Emit;
-using Xunit;
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class GetFunctionPointerForDelegateTests
-    {
-        [Fact]
-        public void GetFunctionPointerForDelegate_DelegateCollectible_ThrowsNotSupportedException()
-        {
-            MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method));
-
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type", TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.AutoClass, typeof(MulticastDelegate));
-            ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(object), typeof(IntPtr) });
-            constructorBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
-
-            MethodBuilder methodBuilder = typeBuilder.DefineMethod("Invoke", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, targetMethod.ReturnType, targetMethod.GetParameters().Select(p => p.ParameterType).ToArray());
-            methodBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
-
-            Type type = typeBuilder.CreateType();
-
-            Delegate d = targetMethod.CreateDelegate(type);
-            Assert.Throws<NotSupportedException>(() => Marshal.GetFunctionPointerForDelegate(d));
-        }
-    }
-}
index 93cc3b1..45d974d 100644 (file)
@@ -54,6 +54,7 @@ namespace System.Runtime.InteropServices.Tests
             AssertExtensions.Throws<ArgumentNullException>("o", () => Marshal.GetIDispatchForObject(null));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
         [ConditionalFact]
         [PlatformSpecific(TestPlatforms.Windows)]
         [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Marshal.GetIDispatchForObject is not implemented in .NET Core.")]
@@ -67,6 +68,7 @@ namespace System.Runtime.InteropServices.Tests
             object o = Activator.CreateInstance(type);
             Assert.Throws<NotSupportedException>(() => Marshal.GetIDispatchForObject(o));
         }
+#endif
 
         [Theory]
         [MemberData(nameof(GetIDispatchForObject_Invalid_TestData))]
index 5208c04..7196134 100644 (file)
@@ -449,6 +449,7 @@ namespace System.Runtime.InteropServices.Tests
             }
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNative))]
         [PlatformSpecific(TestPlatforms.Windows)]
         public void GetNativeVariantForObject_ObjectNotCollectible_ThrowsNotSupportedException()
@@ -471,6 +472,7 @@ namespace System.Runtime.InteropServices.Tests
                 Marshal.FreeHGlobal(pNative);
             }
         }
+#endif
 
         public struct StructWithValue
         {
index 82eedbc..f3559cf 100644 (file)
@@ -117,10 +117,12 @@ namespace System.Runtime.InteropServices.Tests
 
             yield return new object[] { typeof(GenericClass<>) };
 
+#if !netstandard // TODO: Enable for netstandard2.1
             AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.Run);
             ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
             yield return new object[] { typeBuilder };
+#endif
         }
 
         [Theory]
index fe15dbd..6e90af9 100644 (file)
@@ -35,6 +35,7 @@ namespace System.Runtime.InteropServices.Tests
 
             yield return new object[] { new KeyValuePair<string, int>("key", 10) };
 
+#if !netstandard // TODO: Enable for netstandard2.1
             AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
             ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
@@ -52,6 +53,7 @@ namespace System.Runtime.InteropServices.Tests
 
             Type collectibleComImportObject = comImportTypeBuilder.CreateType();
             yield return new object[] { collectibleComImportObject };
+#endif
         }
 
         [Theory]
index 5d902c5..dc5f9be 100644 (file)
@@ -203,6 +203,7 @@ namespace System.Runtime.InteropServices.Tests
             AssertExtensions.Throws<ArgumentException>("structureType", () => Marshal.PtrToStructure((IntPtr)1, structureType));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
         [Fact]
         public void PtrToStructure_NonRuntimeType_ThrowsArgumentException()
         {
@@ -211,6 +212,7 @@ namespace System.Runtime.InteropServices.Tests
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
             AssertExtensions.Throws<ArgumentException>("structureType", "type", () => Marshal.PtrToStructure((IntPtr)1, (Type)typeBuilder));
         }
+#endif
 
         public static IEnumerable<object[]> PtrToStructure_NonBlittableType_TestData()
         {
index 76fb94a..2b5800a 100644 (file)
@@ -10,7 +10,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class ByteTests
+    public class ByteTests
     {
         [Theory]
         [InlineData(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, byte.MaxValue })]
@@ -136,6 +136,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.ReadByte(null, 2));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void ReadByte_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadByte(collectibleObject, 0));
+        }
+#endif
+
         [Fact]
         public void WriteByte_ZeroPointer_ThrowsException()
         {
@@ -150,6 +164,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.WriteByte(null, 2, 0));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void WriteByte_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteByte(collectibleObject, 0, 0));
+        }
+#endif
+
         public struct BlittableStruct
         {
             public byte value1;
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/ByteTests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/ByteTests.nonnetstandard.cs
deleted file mode 100644 (file)
index 5836dff..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.Reflection;
-using System.Reflection.Emit;
-using Xunit;
-
-#pragma warning disable CS0618 // Type or member is obsolete
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class ByteTests
-    {
-        [Fact]
-        public void ReadByte_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadByte(collectibleObject, 0));
-        }
-
-        [Fact]
-        public void WriteByte_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteByte(collectibleObject, 0, 0));
-        }
-    }
-}
-
-#pragma warning restore CS0618 // Type or member is obsolete
index bb66af6..4c53cce 100644 (file)
@@ -10,7 +10,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class Int16Tests
+    public class Int16Tests
     {
         [Theory]
         [InlineData(new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, short.MaxValue })]
@@ -138,6 +138,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.ReadInt16(null, 2));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void ReadInt16_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadInt16(collectibleObject, 0));
+        }
+#endif
+
         [Fact]
         public void WriteInt16_ZeroPointer_ThrowsException()
         {
@@ -152,6 +166,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.WriteInt16(null, 2, 0));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void WriteInt16_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteInt16(collectibleObject, 0, 0));
+        }
+#endif
+
         public struct BlittableStruct
         {
             public short value1;
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int16Tests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int16Tests.nonnetstandard.cs
deleted file mode 100644 (file)
index ef7a06e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.Reflection;
-using System.Reflection.Emit;
-using Xunit;
-
-#pragma warning disable CS0618 // Type or member is obsolete
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class Int16Tests
-    {
-        [Fact]
-        public void ReadInt16_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadInt16(collectibleObject, 0));
-        }
-
-        [Fact]
-        public void WriteInt16_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteInt16(collectibleObject, 0, 0));
-        }
-    }
-}
-
-#pragma warning restore CS0618 // Type or member is obsolete
index a381930..57fb4cb 100644 (file)
@@ -10,7 +10,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class Int32Tests
+    public class Int32Tests
     {
         [Theory]
         [InlineData(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, int.MaxValue })]
@@ -138,6 +138,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.ReadInt32(null, 2));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void ReadInt32_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadInt32(collectibleObject, 0));
+        }
+#endif
+
         [Fact]
         public void WriteInt32_ZeroPointer_ThrowsException()
         {
@@ -152,6 +166,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.WriteInt32(null, 2, 0));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void WriteInt32_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteInt32(collectibleObject, 0, 0));
+        }
+#endif
+
         public struct BlittableStruct
         {
             public int value1;
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int32Tests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int32Tests.nonnetstandard.cs
deleted file mode 100644 (file)
index dcdec8f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.Reflection;
-using System.Reflection.Emit;
-using Xunit;
-
-#pragma warning disable CS0618 // Type or member is obsolete
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class Int32Tests
-    {
-        [Fact]
-        public void ReadInt32_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadInt32(collectibleObject, 0));
-        }
-
-        [Fact]
-        public void WriteInt32_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteInt32(collectibleObject, 0, 0));
-        }
-    }
-}
-
-#pragma warning restore CS0618 // Type or member is obsolete
index 3e00061..7b28d5e 100644 (file)
@@ -10,7 +10,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class Int64Tests
+    public class Int64Tests
     {
         [Theory]
         [InlineData(new long[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, long.MaxValue })]
@@ -150,6 +150,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.ReadInt64(null, 2));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void ReadInt64_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadInt64(collectibleObject, 0));
+        }
+#endif
+
         [Fact]
         public void WriteInt64_ZeroPointer_ThrowsException()
         {
@@ -164,6 +178,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.WriteInt64(null, 2, 0));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void WriteInt64_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteInt64(collectibleObject, 0, 0));
+        }
+#endif
+
         public struct BlittableStruct
         {
             public long value1;
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int64Tests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/Int64Tests.nonnetstandard.cs
deleted file mode 100644 (file)
index 588f6ee..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.Reflection;
-using System.Reflection.Emit;
-using Xunit;
-
-#pragma warning disable CS0618 // Type or member is obsolete
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class Int64Tests
-    {
-        [Fact]
-        public void ReadInt64_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadInt64(collectibleObject, 0));
-        }
-
-        [Fact]
-        public void WriteInt64_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteInt64(collectibleObject, 0, 0));
-        }
-    }
-}
-
-#pragma warning restore CS0618 // Type or member is obsolete
index 4c7fc43..3fe9541 100644 (file)
@@ -12,7 +12,7 @@ using Xunit;
 
 namespace System.Runtime.InteropServices.Tests
 {
-    public partial class IntPtrTests
+    public class IntPtrTests
     {
         public static IEnumerable<object[]> ReadWrite_TestData()
         {
@@ -145,6 +145,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.ReadIntPtr(null, 2));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void ReadIntPtr_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadIntPtr(collectibleObject, 0));
+        }
+#endif
+
         [Fact]
         public void WriteIntPtr_ZeroPointer_ThrowsException()
         {
@@ -159,6 +173,20 @@ namespace System.Runtime.InteropServices.Tests
             Assert.Throws<AccessViolationException>(() => Marshal.WriteIntPtr(null, 2, (IntPtr)0));
         }
 
+#if !netstandard // TODO: Enable for netstandard2.1
+        [Fact]
+        public void WriteIntPtr_NotReadable_ThrowsArgumentException()
+        {
+            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
+            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
+            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
+            Type collectibleType = typeBuilder.CreateType();
+            object collectibleObject = Activator.CreateInstance(collectibleType);
+
+            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteIntPtr(collectibleObject, 0, IntPtr.Zero));
+        }
+#endif
+
         public struct BlittableStruct
         {
             public IntPtr value1;
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/IntPtrTests.nonnetstandard.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/IntPtrTests.nonnetstandard.cs
deleted file mode 100644 (file)
index ee70ab4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Reflection.Emit;
-using Xunit;
-
-#pragma warning disable CS0618 // Type or member is obsolete
-
-namespace System.Runtime.InteropServices.Tests
-{
-    public partial class IntPtrTests
-    {
-        [Fact]
-        public void ReadIntPtr_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.ReadIntPtr(collectibleObject, 0));
-        }
-
-        [Fact]
-        public void WriteIntPtr_NotReadable_ThrowsArgumentException()
-        {
-            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.RunAndCollect);
-            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
-            TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
-            Type collectibleType = typeBuilder.CreateType();
-            object collectibleObject = Activator.CreateInstance(collectibleType);
-
-            AssertExtensions.Throws<ArgumentException>(null, () => Marshal.WriteIntPtr(collectibleObject, 0, IntPtr.Zero));
-        }
-    }
-}
-
-#pragma warning restore CS0618 // Type or member is obsolete
index 39c5556..1f2e5e0 100644 (file)
@@ -65,10 +65,12 @@ namespace System.Runtime.InteropServices.Tests
 
             yield return new object[] { typeof(GenericClass<>).GetTypeInfo().GenericTypeParameters[0], null };
 
+#if !netstandard // TODO: Enable for netstandard2.1
             AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.Run);
             ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module");
             TypeBuilder typeBuilder = moduleBuilder.DefineType("Type");
             yield return new object[] { typeBuilder, "t" };
+#endif
 
             yield return new object[] { typeof(TestStructWithFxdLPSTRSAFld), null };
         }