Exiting the process with the help of Enviroment.FastFail method

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.

Vikram


Share this post   Email it

Feedback

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Copyright © 2006 - 2012 Vikram Lakhotia