Is there an unhandled exception handler in Inventor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In "normal" .Net, I can catch unhandled exceptions via the UnhandledException handler in the application domain. I've tried a very simple example (swiped right from the MS help files..) and it's not working. I'm assuming that it's because Inventor has already grabbed this and its handler is superseding the one I'm trying to create.
Here's the example I'm trying: (External Rule)
Sub Main()
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
Try
Throw New Exception("1")
Catch e As Exception
Logger.Info("Catch clause caught : {0}", e.Message)
End Try
Throw New Exception("2")
End Sub
Sub MyHandler(sender As Object, args As UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
Logger.Info("MyHandler caught : {0}", e.Message)
Logger.Info("Runtime terminating: {0}", args.IsTerminating)
End Sub
The example above should execute MyHandler when the second exception is thrown. Instead, it appears to be trapped by Inventor:
The reason I'm doing this is that I'd like to be able to grab a screen shot and attach that to a support ticket. This will both decrease the reporting requirements of my users and increase the information I've got available when something goes pear shaped on them.
Thanks folks!
g.