[Profiler] Use the correct function to increment the refcount
[mono.git] / mono / tests / unhandled-exception-5.cs
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
5
6 class CustomException : Exception
7 {
8 }
9
10 class Driver
11 {
12         static ManualResetEvent mre = new ManualResetEvent (false);
13
14         class FinalizedClass
15         {
16                 ~FinalizedClass ()
17                 {
18                         try {
19                                 throw new CustomException ();
20                         } finally {
21                                 mre.Set ();
22                         }
23                 }
24         }
25
26         /* expected exit code: 255 */
27         static void Main (string[] args)
28         {
29                 new FinalizedClass();
30
31                 GC.Collect ();
32                 GC.WaitForPendingFinalizers ();
33
34                 if (!mre.WaitOne (5000))
35                         Environment.Exit (2);
36
37                 Environment.Exit (0);
38         }
39 }