Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Probst <mark.probst@gmail.com>2012-11-29 20:35:34 +0400
committerMark Probst <mark.probst@gmail.com>2012-11-29 20:35:34 +0400
commit777de937b654c011b0ad7573cfe7b8c1bc8662d2 (patch)
tree23286487734f69e0e3a537d2c3a2b375dec20660
parent72ebeab25bc1924b7a191a3c59436728d74f6cdb (diff)
[tests] Fix pinning in finalizer-exception.cs.
The finalizable object got pinned, so it wouldn't be finalised. Just recurse a bit and allocate it there.
-rw-r--r--mono/tests/finalizer-exception.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/mono/tests/finalizer-exception.cs b/mono/tests/finalizer-exception.cs
index d11e1696f14..1496dc54b47 100644
--- a/mono/tests/finalizer-exception.cs
+++ b/mono/tests/finalizer-exception.cs
@@ -6,13 +6,25 @@ public class FinalizerException {
throw new Exception ();
}
+ /*
+ * We allocate the exception object deep down the stack so
+ * that it doesn't get pinned.
+ */
+ public static void MakeException (int depth) {
+ if (depth <= 0) {
+ new FinalizerException ();
+ return;
+ }
+ MakeException (depth - 1);
+ }
+
public static int Main () {
AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
Console.WriteLine ("caught");
Environment.Exit (0);
};
- new FinalizerException ();
+ MakeException (100);
GC.Collect ();
GC.WaitForPendingFinalizers ();