OpenPetra
Free Administration Software for Non-Profits
Ict.Common.Remoting.Server.TExceptionHandling Class Reference

Contains procedures for structured Exception handling. They are intended to be used as 'last resort' in case an Exception that was thrown anywhere in the Application wasn't caught anywhere. More...

Static Public Member Functions

static void LogException (Exception AException, String ALogText)
 Logs an Exception and a StackTrace to the Server logfile. More...
 
static void UnhandledExceptionHandler (object ASender, UnhandledExceptionEventArgs AEventArgs)
 
static void FirstChanceHandler (object ASource, FirstChanceExceptionEventArgs AEventArgs)
 Event Handler that gets called before the Common Language Runtime (CLR) begins searching for Event Handlers. This special Event gets hooked up for all AppDomains of the server (incl. the Default Application Domain of the server exe). More...
 

Detailed Description

Contains procedures for structured Exception handling. They are intended to be used as 'last resort' in case an Exception that was thrown anywhere in the Application wasn't caught anywhere.

Member Function Documentation

◆ FirstChanceHandler()

static void Ict.Common.Remoting.Server.TExceptionHandling.FirstChanceHandler ( object  ASource,
FirstChanceExceptionEventArgs  AEventArgs 
)
inlinestatic

Event Handler that gets called before the Common Language Runtime (CLR) begins searching for Event Handlers. This special Event gets hooked up for all AppDomains of the server (incl. the Default Application Domain of the server exe).

Parameters
ASourceProvided automatically by .NET.
AEventArgsProvided automatically by .NET. (The Exception Property of this Argument holds the Exception that just occurred.)

◆ LogException()

static void Ict.Common.Remoting.Server.TExceptionHandling.LogException ( Exception  AException,
String  ALogText 
)
inlinestatic

Logs an Exception and a StackTrace to the Server logfile.

Parameters
AExceptionThe Exception to log.
ALogTextAdditional Text to be logged.
Returns
void

◆ UnhandledExceptionHandler()

static void Ict.Common.Remoting.Server.TExceptionHandling.UnhandledExceptionHandler ( object  ASender,
UnhandledExceptionEventArgs  AEventArgs 
)
inlinestatic

No finalizers are executed by the CLR when an unhandled exception occurs, even when a Handler like this is hooked up to the AppDomain.CurrentDomain.UnhandledException Event! Also, all threads are silently killed without a chance to execute their catch/finally blocks to do an orderly shutdown. To force an 'ordered cooperative shutdown' that overcomes those limitations, we need to do this from another Thread (MS didn't do their job properly here...).

See http://geekswithblogs.net/akraus1/archive/2006/10/30/95435.aspx for an explanation of how (and why) this overcomes those limitations!

Parameters
ASenderThe source of the unhandled exception event.
AEventArgsAn UnhandledExceptionEventArgs that contains the event data.

The documentation for this class was generated from the following file: