Crash handling
We need to know why this application crashed.
This library provides you a way to handle crashes using the built-in UnhandledException event in the AppDomain.CurrentDomain property. It uses either a built-in crash handler, which saves the crash dump containing crash information to a log file, or a custom handler, which is a delegate of type Action<UnhandledExceptionEventArgs> that allows you to specify how you want to handle crashes.
The process
To install a crash handler, you can call the InstallCrashHandler() function in the CrashTools class. It can hold either a parameter that specifies such a delegate, or you can pass nothing, which is equivalent to passing null, that uses the built-in crash handler.
The crash handling process works like this:
Second chance crash handling
In case the handler crashes, it checks to see if the crash handler is a custom one.
If the crash handler is a custom function, the handler will re-run with the built-in handler in case the problem is with the custom crash handler, but will not propagate the exception that caused the custom handler to crash.
If the crash handler is a built-in handler, the handler will throw an exception.
The exception is then passed to the second-chance crash handler that outputs just a simple crash dump file.
Third chance hard fail stage
If the second-chance crash handler fails, the exception is passed as an argument to the FailFast() function in the Environment class, which makes the operating system handle the crash.
Crash logs are created in the following directories:
Windows:
%LOCALAPPDATA%\Aptivi\CrashesLinux:
$HOME/.config/Aptivi/Crashes
Fatal crash dumps are prefixed with f_.
Last updated