summaryrefslogtreecommitdiff
path: root/tests/src/GC/API/GC/ReRegisterForFinalize_null.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/GC/API/GC/ReRegisterForFinalize_null.cs')
-rw-r--r--tests/src/GC/API/GC/ReRegisterForFinalize_null.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/src/GC/API/GC/ReRegisterForFinalize_null.cs b/tests/src/GC/API/GC/ReRegisterForFinalize_null.cs
new file mode 100644
index 0000000000..06f4e08dfe
--- /dev/null
+++ b/tests/src/GC/API/GC/ReRegisterForFinalize_null.cs
@@ -0,0 +1,42 @@
+// 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.
+
+// Tests ReRegisterForFinalize()
+
+using System;
+
+public class Test
+{
+ public bool RunTest()
+ {
+ try
+ {
+ GC.ReRegisterForFinalize(null); // should call Finalize() for obj1 now.
+ }
+ catch (ArgumentNullException)
+ {
+ return true;
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Unexpected Exception!");
+ }
+
+ return false;
+ }
+
+
+ public static int Main()
+ {
+ Test t = new Test();
+ if (t.RunTest())
+ {
+ Console.WriteLine("Null Test for ReRegisterForFinalize() passed!");
+ return 100;
+ }
+
+ Console.WriteLine("Null Test for ReRegisterForFinalize() failed!");
+ return 1;
+ }
+}