W
Willy Denoyette [MVP]
Jon Skeet said:It sort of is, actually. The finalizer thread is getting blocked, so
none of the test class instances are getting collected. I believe the
finalizer thread is waiting to execute code on the STAThread, which it
can't do because that thread is always busy.
It's worth noting that any of the following remove the problem:
1) Running under .NET 2.0
2) Removing the creation/disposal of the connection
3) Removing the STAThread attribute
4) Removing the finalizer from TestClass
Jon,
Could add a call To WaitForPendingFinalizers() after the Dispose call, with
the STAThread set and see what happens?
I'm looking at the v1.1 sources and found a COM dependency, this part is
somewhat complex code so before I go deeper I would see this confirmed.
Why? Well, it would confirm that the finalizer is blocked trying to finalize
the RCW on an STA thread that doesn't pump messages! (which is real bad).
That would also explain why there is no issue on an MTA thread.
Willy.