[Mono-bugs] [Bug 77170][Wis] New - set null to WeakReference.Target doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jan 6 10:54:24 EST 2006


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 burlachenkoo at mail.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=77170

--- shadow/77170	2006-01-06 10:54:24.000000000 -0500
+++ shadow/77170.tmp.3024	2006-01-06 10:54:24.000000000 -0500
@@ -0,0 +1,69 @@
+Bug#: 77170
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: BurlachenkoO at mail.ru               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: set null to WeakReference.Target doesn't work
+
+Description of Problem:
+set null to WeakReference.Target doesn't work
+
+Steps to reproduce the problem:
+I execute such code in C# console project:
+using System;
+
+namespace Mono_GC {
+  class A{}
+
+  class Class1 {
+
+    [STAThread]
+    static void Main(string[] args) {
+
+      A a = new A();
+      WeakReference weak = new WeakReference(a);
+      Console.WriteLine("weak.Target = " + a);
+      if(weak.Target != null)
+        Console.WriteLine("weak.Target != null");
+      else
+        Console.WriteLine("weak.Target == null");
+
+      weak.Target = null;
+      Console.WriteLine("weak.Target = null");
+      if(weak.Target != null)
+        Console.WriteLine("test failed");
+      else
+        Console.WriteLine("test passed");
+
+      Console.WriteLine("Weak reference test has been finished.");
+    }
+  }
+}
+
+Actual Results:
+weak.Target = Mono_GC.A
+weak.Target != null
+weak.Target = null
+test failed
+Weak reference test has been finished.
+
+Expected Results:
+weak.Target = Mono_GC.A
+weak.Target != null
+weak.Target = null
+test passed
+Weak reference test has been finished.
+
+How often does this happen? 
+every run


More information about the mono-bugs mailing list