none
How catch unhandle exception in outlook addin?

    Question

  • hi all

     I have added AppDomain.CurrentDomain.UnhandledException event ,but it can't catch the unhande exception.

    so how to catch the unhande exception in add-in ?

    thanks
    Daniel
    Wednesday, October 21, 2009 5:42 AM

Answers

All replies

  • My addin is a wpf control, and host at elementHost.


    Daniel
    Wednesday, October 21, 2009 7:41 AM
  • Hello Daniel,

    For unhandled exception, this issue has been discussed in this forum many times. Search this forum with key string "unhandled exception", and you will see a couple of threads. In general, you will get this answer form this thread: Catching Unhandled Exceptions and this link.

    Useful link:
    UnhandledExceptionEventHandler Delegate.
    AppDomain.UnhandledException Event.

    You could use try/catch block to catch this exception.

    Best regards,
    Bessie

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Bessie Zhao Wednesday, October 28, 2009 2:06 AM
    Thursday, October 22, 2009 7:46 AM
  • This is correct in most cases, however, if the Outlook Add-In is a VSTO Add-In, then you need to implement the above to catch unhandled exceptions that come from any dialogs you may have however, MOST unhandled exception will be caught by the VSTO "shim". I don't know of a way to catch those before VSTO does, except to catch the exception as close to the point of origination as possible, at which point it no longer becomes an unhandled exception :)
    -mc
    Friday, November 12, 2010 6:01 PM