The main change, so comments may seem inappropriate. We apologize for the inconvenience.
Hard to say for sure.
Assuming the code looks something like this:
public class SomeType {
private static readonly object Lock = new object();
public void Foo() {
lock (Lock) {
Console.WriteLine("in foo");
GC.Collect(2);
GC.WaitForPendingFinalizers();
GC.Collect(2);
}
}
~SomeType() {
lock (Lock) {
Console.WriteLine("in finalizer");
}
}
}
You can get a dead end if you had more instances SomeType, since they all use a static object to lock. You must have at least one uncovered and unsigned instance SomeTypeand call Fooin another instance.
, , , , .