summaryrefslogtreecommitdiff
path: root/tests/src/Regressions/coreclr/GitHub_12224/test12224.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/Regressions/coreclr/GitHub_12224/test12224.cs')
-rw-r--r--tests/src/Regressions/coreclr/GitHub_12224/test12224.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/src/Regressions/coreclr/GitHub_12224/test12224.cs b/tests/src/Regressions/coreclr/GitHub_12224/test12224.cs
new file mode 100644
index 0000000000..8a3124c1b8
--- /dev/null
+++ b/tests/src/Regressions/coreclr/GitHub_12224/test12224.cs
@@ -0,0 +1,43 @@
+// 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 Test12224
+{
+ // Regression test for EH getting stuck in an infinite loop when NullReferenceException
+ // happens inside a handler of another NullReferenceException.
+ static void ExecuteTest(object context)
+ {
+ string s = null;
+ try
+ {
+ try
+ {
+ int x = s.Length;
+ }
+ catch (NullReferenceException)
+ {
+ int x = s.Length;
+ }
+ }
+ catch (NullReferenceException)
+ {
+
+ }
+ }
+
+ public static int Main()
+ {
+ Thread thread = new Thread(new ParameterizedThreadStart(Test12224.ExecuteTest));
+ thread.IsBackground = true;
+ thread.Start(null);
+
+ // Give the thread 30 seconds to complete (it should be immediate). If it fails
+ // to complete within that timeout, it has hung.
+ bool terminated = thread.Join(new TimeSpan(0, 0, 30));
+
+ return terminated ? 100 : -1;
+ }
+}