#940 – Finalizers Are Called when an Application Shuts Down

A finalizer is an override of the System.Object.Finalize method that you implement using the destructor syntax.  The finalizer is called automatically by the garbage collector, before it releases memory for the object.

Finalizers are also called when an application shuts down.  Before the application shuts down, the finalizers of any objects that still exist on the managed heap are called.  Note that this is only true if the application shuts down in a controlled manner.  If the application crashes, the finalizers will not be called.