private void TestReadWriteAccessAfterDispose() { Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)); Debug.WriteLine("\nLinuxOpenSSL11ProtectedMemoryAllocatorTest ctor"); linuxOpenSSL11ProtectedMemoryAllocatorLP64 = new LinuxOpenSSL11ProtectedMemoryAllocatorLP64(configuration); linuxOpenSSL11ProtectedMemoryAllocatorLP64.Dispose(); var exception = Assert.Throws <Exception>(() => { linuxOpenSSL11ProtectedMemoryAllocatorLP64.SetReadWriteAccess(new IntPtr(-1), 0); }); Assert.Equal("Called SetReadWriteAccess on disposed LinuxOpenSSL11ProtectedMemoryAllocatorLP64", exception.Message); }