- Console.WriteLine("finalizer thread ID: {0}", (string)Thread.GetData(dataslot));
- throw new SystemException("wibble");
- }
-
- public static int Main() {
- ArrayList list = new ArrayList ();
- Thread.SetData(dataslot, "ID is wibble");
- Environment.ExitCode = 2;
- while(true) {
- foo instance = new foo();
- list.Add (new WeakReference(instance));
+ /*
+ * We allocate the exception object deep down the stack so
+ * that it doesn't get pinned.
+ */
+ public static unsafe void MakeException (int depth) {
+ // Avoid tail calls
+ int* values = stackalloc int [20];
+ aptr = new IntPtr (values);
+ if (depth <= 0) {
+ for (int i = 0; i < 10; i++)
+ new FinalizerException ();
+ return;