title: C# weak reference still valid after object GC?
body: <p>I've got a quick code piece to test weak reference, I expect that after the object being GC, the weak reference should not longer return a object referenct. But my test shows this is not expected:</p>
  
  <pre><code>class Person
  {
      private int mI = 3;
      public int MI { get =&gt; mI; set =&gt; mI = value; }
  }
  class UseWeakReference
  {
      public static void Main(String[] args)
      {
          Person person = new Person();
          WeakReference&lt;Person&gt; wr = new WeakReference&lt;Person&gt;(person);
  
          wr.TryGetTarget(out Person p1);
          Console.WriteLine(p1);
  
          person = null;
          wr.TryGetTarget(out Person p2);
          Console.WriteLine(p2);
  
          p2 = null;
          System.GC.Collect();
          Thread.Sleep(1000);
          wr.TryGetTarget(out Person p3);
          Console.WriteLine(p3); // I expected null here becaure person is collected.
      }
  }
  </code></pre>
  
  <p>It prints:</p>
  
  <pre><code>MyApp1.Person
  MyApp1.Person
  MyApp1.Person // Why still valid?
  </code></pre>
  
  <p>Where did I get wrong?</p>
  
  <p>Thanks.</p>