How can I handle the exception which throws on an external dll?

后端 未结 4 637
北海茫月
北海茫月 2021-01-18 03:50

I have developed a project which uses an external dll as FTPServer, I have created the FTP Server on my project like this:

private ClsFTPServer _ClsFTPServer;

4条回答
  •  孤独总比滥情好
    2021-01-18 04:31

    I recently answered a similar (ish) question which may prove useful - Catch completely unexpected error

    EDIT. I have to agree with Hans' comment above - might be an idea to find another FTP server.

    Just for completeness, here's the appdomain/thread exception setup from - http://msdn.microsoft.com/en-GB/library/system.windows.forms.application.threadexception.aspx

    Application.ThreadException += new ThreadExceptionEventHandler  (ErrorHandlerForm.Form1_UIThreadException);
    
    // Set the unhandled exception mode to force all Windows Forms errors to go through 
    // our handler.
    Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
    
    // Add the event handler for handling non-UI thread exceptions to the event. 
    AppDomain.CurrentDomain.UnhandledException +=
        new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
    

提交回复
热议问题