summaryrefslogtreecommitdiff
path: root/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs')
-rw-r--r--tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs
new file mode 100644
index 0000000000..d50826df4c
--- /dev/null
+++ b/tests/src/baseservices/threading/coverage/Nullref/CS_RWHNullRefEx.cs
@@ -0,0 +1,76 @@
+// 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;
+using System.Threading;
+
+public class mytest {
+ public static int Main(String [] args) {
+ int rValue = 100;
+ RegisteredWaitHandle rwh = null;
+
+ Console.WriteLine("Test AutoResetEvent for expected NullRef Exceptions");
+ Console.WriteLine( );
+
+
+ try {
+ rwh.Equals(new ManualResetEvent(true));
+ rValue = 4;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.Equals(new ManualResetEvent()))");
+ }
+
+ try {
+ rwh.GetHashCode();
+ rValue = 5;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.GetHasCode())");
+ }
+
+ // try {
+ // rwh.GetLifetimeService();
+ // rValue = 6;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (rwh.GetLifetimeService())");
+ // }
+
+ try {
+ rwh.GetType();
+ rValue = 7;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.GetType())");
+ }
+
+ // try {
+ // rwh.InitializeLifetimeService();
+ // rValue = 8;
+ // }
+ // catch (NullReferenceException) {
+ // Console.WriteLine("Caught NullReferenceException (rwh.InitializeLifeTimeService())");
+ // }
+
+ try {
+ rwh.ToString();
+ rValue = 11;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.ToString())");
+ }
+
+ try {
+ rwh.Unregister(new AutoResetEvent(true));
+ rValue = 12;
+ }
+ catch (NullReferenceException) {
+ Console.WriteLine("Caught NullReferenceException (rwh.Unregister())");
+ }
+
+
+ Console.WriteLine("Return Code == {0}",rValue);
+ return rValue;
+ }
+}