Handling the InternalException or an application crash from the add-in.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have an add-in that monitors open document elements, read-only, figuring how many sheets, links, families etc., using a bunch of IUpdaters, and further sends them off to an external server for some usage analysis. I would like to be able to detect a crash in the application, before the "Unrecoverable error has occurred" dialog, so I can flag my monitoring data with the last result as "crashed", which would help me with the analysis.
I have to say that I am simulating a crash by running two FilteredElementCollectors in a BackgroundWorker, I know, blasphemy. This causes an InternalException with the error/submit report dialog.
What I've tried so far:
- As per The Building Coder: http://thebuildingcoder.typepad.com/blog/2013/10/handle-your-own-exceptions-and-edit-slab-boundaries... subscribing to the App.Domain.CurrentDomain.UnhandledException doesn't work for me and the handler doesn't get called.
- FailureProcessor and FailurePreprocessor don't work with the InternalException, perhaps I need a better crashing sample file.
- A watchdog application (wrapper) that calls the Revit executable and looks at the exit code/reads the journal file, this works, but would be better to have a self-contained solution.
What I'm trying to achieve:
- Before Revit throws and exists, I collect some bits of info, timestamps (no longer need RevitAPI), and make a POST to a webapi with this info.
Is this possible?
Thank you,
Alex