[Mono-bugs] [Bug 68775][Min] Changed - WeakReference.TrackResurrection not implemented

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 5 Nov 2004 14:27:30 -0500 (EST)


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-11-03 15:49:25.000000000 -0500
+++ shadow/68775.tmp.21306	2004-11-05 14:27:30.000000000 -0500
@@ -66,6 +66,24 @@
 sigh. ok, i think there'd still be a race condition making it not
 work for us anyway.
 
 (leaving the bug open since it's still a bug that we don't
 implement this though.)
 
+
+------- Additional Comments From danw@novell.com  2004-11-05 14:27 -------
+Undocumented things I figured out while investigating this:
+
+In Mono, a WeakReference goes "dead" as soon as the object is added
+to the finalization queue.
+
+In .NET, non-TrackResurrection weakrefs behave the same way, but
+TrackResurrection weakrefs stay valid all the way through the
+referenced object's finalizer. If you don't resurrect the object
+from the finalizer, the weakref seems to die immediately after the
+finalizer runs.
+
+"Resurrecting" the object seems to mean assigning "this" to
+anything. Even if you say "this.foo = this;", it considers the
+object resurrected, and the weakref stays valid. (At least until
+the next GC cycle.)
+