Using Enviroment.FastFail method to exit the corrupt application Process
Have you ever had
some point in code where you want to exit the application immediately?
Normally for this purpose you would use the Application.Exit method. But Microsoft has provided a better method for this
purpose which not only just exits the application but also adds a
message to the Windows Application event log.
The
Enviroment.FastFail method takes a string as a parameter writes that
value to the Windows Application Event log, creates a dump of the
application and exits the process. The string passed is also included in
the error reporting to Microsoft.
FastFail method
should be used instead of the Application.Exit method in case the
application is damaged / resource Lost etc. beyond damage and execution
of the applications try/finally blocks and finalizer can corrupt the
program resources.