I’m researching crash reporting, and looking to implement a service similar to crashalytics in mobile.
Right now I’m testing Raygun, but I’m having some trouble with the implementation.
The recommended implementation in IExtensionApplication.Initialize looks like this:
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
_Client.Send(e.ExceptionObject as Exception);
}
This doesn’t work, and my understanding is that AutoCAD is catching all unhandled exceptions, so the call never rises up to AppDomain.CurrentDomain.UnhandledException
So I tried adding a handler via FirstChanceException, but that catches all kinds of weird stuff that autocad handles, and so the reporting is throwing errors that aren’t actually affecting the user. That code looks like this:
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
private void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
if (e
.Exception is Autodesk
.AutoCAD.Runtime.Exception) {
_Client.Send(e.Exception);
}
}
One option is to wrap all my code in try catch blocks, and send errors from there, but this seems it could make things difficult if I decide to switch to a different reporting tool.
Ideally, I could just add an error handler somewhere in IExtensionApplication.Initialize. Any recommendations from those of you that have done this? Not just in how to implement something like this, but in services as well. I’d like to use a service that sends me stack traces and reports on crashes so I know which errors are causing the most problems. Recomendations from swampers who are using a similar tool for AutoCAD projects would be helpful.