.NET - Finalizers and exit(0)
I have a .NET C# / C++ app which uses a call to exit(0) (from <stdlib.h> ) in a thread in order to terminate. The strange part is, under some circumstances, the finalizers of the managed objects are called right after the call to exit , and in other circumstances, they are not called at all. The circumstances are pretty deterministic - the app calls some methods from an external plugin dll (written in unmanaged C) during its lifetime. If I use dll A, the finalizers are always called. If I use dll B, the finalizers are never called. What's the expected behaviour of finalizers in case of an exit