DVTk API
CustomExceptionHandler Class
DVTkDvtkApplicationLayerCustomExceptionHandler
DVTk API

[This is preliminary documentation and is subject to change.]

The Error Handler class. Use this class to be able to show more information in case of an exception in a release version (the same information is shown for a debug version). This class is now most suitable for a windows application. We need a class because event handling methods can't be static. Usage of this class: The first lines of code of the entry point of the application should be: // Only one of the exception handlers below will be used: // - Application.ThreadException will be fired for a windows application // - System.AppDomain.CurrentDomain.UnhandledException will be fired for other applications. CustomExceptionHandler eh = new CustomExceptionHandler(); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(eh.OnThreadException); System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(eh.OnAppDomainUnhandledException); At the end of the outer catch block of a .Net thread, add the following code (don't do this for a HLI Thread, there is a different exception handler mechanism already present): // Problem: // Errors thrown from a workerthread are eaten by the .NET 1.x CLR. // Workaround: // Directly call the global (untrapped) exception handler callback. // Do NOT rely on // either // - System.AppDomain.CurrentDomain.UnhandledException // or // - System.Windows.Forms.Application.ThreadException // These events will only be triggered for the main thread not for worker threads. // CustomExceptionHandler eh = new CustomExceptionHandler(); System.Threading.ThreadExceptionEventArgs args = new ThreadExceptionEventArgs(ex); eh.OnThreadException(this, args); // // Rethrow. This rethrow may work in the future .NET 2.x CLR. // Currently eaten. // throw ex;
Declaration Syntax
C#Visual BasicVisual C++
public class CustomExceptionHandler
Public Class CustomExceptionHandler
public ref class CustomExceptionHandler
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
CustomExceptionHandler()()()
Initializes a new instance of the CustomExceptionHandler class

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetHashCode()()()
Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from Object.)
GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
OnAppDomainUnhandledException(Object, UnhandledExceptionEventArgs)
The handler of the unhandled exception.

OnThreadException(Object, ThreadExceptionEventArgs)
Handle the exception event.

ShowExceptions

ShowThreadExceptionDialog(Exception)
The simple dialog that is displayed when this class catches and exception.

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Inheritance Hierarchy
Object
CustomExceptionHandler

Assembly: DvtkApplicationLayer (Module: DvtkApplicationLayer) Version: 0.0.0.0