Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Configuration Namespace / ListenerConfiguration Class / CatchApplicationExceptions Property

In This Topic
    CatchApplicationExceptions Property
    In This Topic
    When true, uncaught exceptions in a Windows Forms application thread will be handled by the Agent.
    Syntax
    'Declaration
     
    
    Public Property CatchApplicationExceptions As Boolean
    public bool CatchApplicationExceptions {get; set;}
    Remarks

    In a Windows Forms application, the Application.Run message loop can be configured to CatchException and issue them to the Application.ThreadException event handler, rather than to ThrowException on up to become fatal UnhandledException events.

    If the Loupe Agent is configured to catch application exceptions (the default setting), the Agent will attempt to set CatchException as the setting for all application UI threads which are left in the default Automatic mode. This can only work if the Agent is able to do so before any Forms are created, so it is recommended that a log message be issued through Log.TraceInformation (if Gibraltar Agent is linked to your application statically by reference to Gibraltar.Agent.dll) or through Trace.TraceInformation (if the Loupe Agent is linked to your application dynamically by adding Loupe as a TraceListener in your app.config) early in your Program.Main method to cause the Loupe Agent to initialize itself at that point.

    If the Agent is configured not to catch application exceptions (or if it is not a Windows application) then it will not alter the default UnhandledExcetionMode and the Agent will not listen for Application.ThreadException events. Unlike most events in .NET, these events are only sent to a single subscriber. The most recent handler registered on that UI thread overwrites any previous handler, so even if the Agent is configured to catch application exceptions the Agent's handler can be overridden by registering your own handler for the event after initializing Loupe and before creating your application's first Form.

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also