I\'d like to verify that code setting up a WeakReference does not accidentally hold a strong reference to the referenced object. (Here\'s an example of how it is easy to acciden
I got in touch with Microsoft about this and learned/confirmed that:
GC.Collect()
forces a blocking garbage collection.GC.Collect()
runs, it won't mysteriously skip over collection-eligible objects. Predictable rules are followed for determining which objects to collect. As long as you operate with an understanding of those rules (i.e. how finalizable objects are handled), you can force a particular object to be destroyed though the memory used by the destroyed object may or may not be freed.More information on my blog: Can .Net garbage collection be forced?