Current .Net Version: 2.0.50727
Home
Articles
C# & .Net Framework Reference
Practice C# Online
XML Web Services
RSS Feeds
Code Snippets
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog




ROR XML Info.
Visual C# Code Snippets

Click here for information on how to use code snippets in VS.NET (2005+)

Exit Current Process and Write an Error to the Event Log Without Processing Try-Catch-Finally Code Blocks [Code | XML]

Title: Exit Current Process and Write an Error to the Event Log Without Processing Try-Catch-Finally Code Blocks
Shortcut: failfast
Description: The System.Environment.FailFast method ends the current process without running any code inside of any try-catch-finally blocks or Finalizer methods and writes an optional error message to the Event Log. Calling FailFast will result in the current aplication exiting in a brute manner. Use FailFast only in situations where executing any additional code in the application is unwanted. The only code that is permitted to execute after a FailFast call is the finalizer of an instantiated class that inherets from the CriticalFinalizerObject class.
Author: C# .Net Fun - http://www.dotnetfun.com - Michael G.

Declarations:
Literal:
ID:
Type:
ToolTip:
Default:
Object:
ID: strErrorMessage
Type: System.String
ToolTip: The error message to write to the application event log when FailFast is called.
Default: "Test Error!"
Code View:

XML View:

Open/Save | E-mail | Back
 
COPYRIGHT/DISCLAIMER | CONTACT US