Fix interop test expecting ArgumentNullException (dotnet/corefx#30895)
authorStephen Toub <stoub@microsoft.com>
Sun, 8 Jul 2018 13:07:53 +0000 (09:07 -0400)
committerGitHub <noreply@github.com>
Sun, 8 Jul 2018 13:07:53 +0000 (09:07 -0400)
Commit migrated from https://github.com/dotnet/corefx/commit/a51556435393cf9ad4b9a3fac9b27bcc5ae1ea9e

src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReadWrite/ObjectTests.cs

index 917417d..8a78c22 100644 (file)
@@ -29,15 +29,15 @@ namespace System.Runtime.InteropServices.Tests
         [ActiveIssue(30830, TargetFrameworkMonikers.NetFramework)]
         public void NullValueArguments_ThrowsArgumentNullException()
         {
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.WriteByte(null, 0, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.WriteInt16(null, 0, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.WriteInt32(null, 0, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.WriteInt64(null, 0, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.WriteIntPtr(null, 0, IntPtr.Zero); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.ReadByte(null, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.ReadInt16(null, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.ReadInt32(null, 0); });
-            AssertExtensions.Throws<ArgumentNullException>("ptr", () => { Marshal.ReadIntPtr(null, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.WriteByte(null, 0, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.WriteInt16(null, 0, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.WriteInt32(null, 0, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.WriteInt64(null, 0, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.WriteIntPtr(null, 0, IntPtr.Zero); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.ReadByte(null, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.ReadInt16(null, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.ReadInt32(null, 0); });
+            Assert.Throws<AccessViolationException>(() => { Marshal.ReadIntPtr(null, 0); });
         }
 
         [Fact]