Message 1 of 7
Catching all unhandled exceptions in an AutoCAD Plugin
Not applicable
01-25-2013
02:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi again. I am trying to make an universal catcher for all unhandled exceptions (System.Exception) on an AutoCAD plugin. My guess is that a static method is to be hooked on an object, but I haven't figured what that object is for the AutoCAD application. Can someone help me out? Here is a C# test plugin:
namespace TestPlugin {
public class Main : IExtensionApplication {
public void Initialize() {
throw new System.Exception();
}
public void Terminate() {
}
static void AutoPanelExceptionHandler(
object sender,
UnhandledExceptionEventArgs e
) {
if(e != null) {
Autodesk.AutoCAD.ApplicationServices.Application
.DocumentManager.MdiActiveDocument.Editor
.WriteMessage("Exception caught!");
}
}
}
}

