Dispose wird nur dann aufgerufen, wenn du das irgendwo im restlichen Code selbst tust

. IDisposable ist nur ein gewöhnliches Pattern und nicht irgendwie in der CLR verankert.
Ich würde (keine Singletons schreiben, aber lassen wir das

) mich in Application.ApplicationExit und AppDomain.UnhandledException einklinken. Ansonsten könntest du auch einen Destruktor benutzen, aber auch der muss nicht immer aufgerufen werden:
Zitat: |
The Finalize method might not run to completion or might not run at all in the following exceptional circumstances:
Another finalizer blocks indefinitely (goes into an infinite loop, tries to obtain a lock it can never obtain and so on). Because the runtime attempts to run finalizers to completion, other finalizers might not be called if a finalizer blocks indefinitely.
The process terminates without giving the runtime a chance to clean up. In this case, the runtime's first notification of process termination is a DLL_PROCESS_DETACH notification.
|