Exception reporting from a WPF Application

后端 未结 4 1613
刺人心
刺人心 2021-02-05 13:09

So lets say I happen to have an unhandled exception in my application or it crashes for some reason. Is there some way for me to capture the output and show an error report dial

4条回答
  •  伪装坚强ぢ
    2021-02-05 13:48

    You can use NBug library for that (also you can use the nuget package here for easy installation). Simply install the NuGet package and configure it like below:

    NBug.Settings.Destination1 =
      "Type=Mail;From=me@mycompany.com;To=bugtracker@mycompany.com;SmtpServer=smtp.mycompany.com;";
    AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
    Application.Current.DispatcherUnhandledException += NBug.Handler.DispatcherUnhandledException;
    

    Now all unhandled exceptions will be nicely caught and giftwrapped for you and you'll get full details of the exception via email. Use the configurator tool to make sure that your configuration is correct.

提交回复
热议问题