If you have a finalizer, watch your ctor

added by DotNetKicks
11/30/2017 1:03:42 PM

3 Kicks, 335 Views

So here is what will happen, the ctor throws, so no one can have an instance of this class. But the finalizer is already tracking it, and will call the finalizer. The finalizer will call the Dispose method, and that will end up throwing, and an exception during finalization is fatal to the entire process.


0 comments