As far as I know, GC won't touch object references in use. I was
susprised to see that one of my trace listeners got disposed at some
point during the life of the application.
It's true I am not holding any references to my trace listener (because
I don't need to), and besides, I guessed that Trace.Listeners.Add will
hold that reference for me. However, at some point, calling one of the
methods of Trace failed with an ObjectDisposedException signaling me
that the listener has closed down.
Can someone please clarify this behaviour for me? Even if I,
personally, am not holding a reference but the framework does, how is
this possible?
Peter Ritchie - 20 Jun 2006 16:54 GMT
Could you post some example code? I use trace listeners all the time without
keeping a reference to them and don't have this problem.

Signature
http://www.peterRitchie.com/
> As far as I know, GC won't touch object references in use. I was
> susprised to see that one of my trace listeners got disposed at some
[quoted text clipped - 9 lines]
> personally, am not holding a reference but the framework does, how is
> this possible?