[Mono-bugs] [Bug 68775][Min] New - WeakReference.TrackResurrection not implemented
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 25 Oct 2004 15:38:05 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by danw@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=68775
--- shadow/68775 2004-10-25 15:38:05.000000000 -0400
+++ shadow/68775.tmp.28094 2004-10-25 15:38:05.000000000 -0400
@@ -0,0 +1,59 @@
+Bug#: 68775
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: danw@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: WeakReference.TrackResurrection not implemented
+
+mono/metadata/gc.c does not treak HANDLE_WEAK_TRACK weakrefs any
+different from HANDLE_WEAK ones, meaning that WeakReferences with
+resurrection tracking don't actually work. (They behave exactly
+the same as WeakReferences without resurrection tracking.)
+
+Test program:
+
+using System;
+
+public class Foo {
+ ~Foo () { Console.WriteLine ("finalized"); }
+}
+
+public class Test {
+ static void Main () {
+ WeakReference ref1, ref2;
+ Foo foo;
+
+ foo = new Foo ();
+ ref1 = new WeakReference (foo, false);
+ ref2 = new WeakReference (foo, true);
+ foo = null;
+
+ GC.Collect ();
+ GC.WaitForPendingFinalizers ();
+
+ Console.WriteLine ("ref1 is {0}", ref1.Target == null ? "null" : "valid");
+ Console.WriteLine ("ref2 is {0}", ref2.Target == null ? "null" : "valid");
+ }
+}
+
+
+result on Mono:
+finalized
+ref1 is null
+ref2 is null
+
+result on .NET:
+finalized
+ref1 is null
+ref2 is valid