The following API in Spotfire application.Exiting(...) is supposed to fire when Spotfire is exiting. This would allow us to do any necessary cleanups before Spotfire dies. But unfortunatly, this API is not working. The workaround is to use either .net events:
AppDomain.CurrentDomain.ProcessExit
or
Application.ApplicationExit
These work fine, but they do not fire when the application crashes Or is killed from an outside tool (like Task Manager) this causing unmanaged resources (file handlers, DB connections ... ) open!
Please fix application.Exiting(...) so that it works in normal mode (when Spotfire closes garcefully) and in harsh modes (when Spotfire crashes or killed by an external tool).