1

关于N Bug的两个问题:

  1. 如果我在代码中有这样的配置,是否可以省略 NBug.config 文件:

    static void Main()
    {
          //NBug Crash Handling
          NBug.Settings.ReleaseMode = true;
          NBug.Settings.MiniDumpType = NBug.Enums.MiniDumpType.Normal;
          NBug.Settings.StopReportingAfter = 365;
          NBug.Settings.WriteLogToDisk = true;
          NBug.Settings.ExitApplicationImmediately = true;
          NBug.Settings.StoragePath = "WindowsTemp";
    
          AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
          Application.ThreadException += NBug.Handler.ThreadException;
          [...]
    }
    
  2. 为什么在创建崩溃转储并重新启动应用程序后,这部分代码从未执行?

    public MainMenu()
    {
          InitializeComponent();
    
          //add handler on application load
          NBug.Settings.CustomSubmissionEvent += Settings_CustomSubmissionEvent;
    
          // Custom Submission Event handler
          void Settings_CustomSubmissionEvent(object sender, CustomSubmissionEventArgs e)
          {
              //your sumbmission code here...
              MessageBox.Show(e.FileName.ToString());
              //.....
              //tell NBug if submission was successfull or not
              e.Result = true;
          }
          [...]
    }
    
4

1 回答 1

1
  1. 看起来不错,应该工作得很好。
  2. 如果从源代码编译,请在此处设置断点,看看会发生什么:https ://github.com/soygul/NBug/blob/d48942b844f3ea2a6e90b993f4c63565e0426944/NBug/Core/Submission/Custom/Custom.cs#L44

如果您使用的是 nuget 包,则它已过时,因此可能无法正常工作。

于 2017-05-18T16:33:56.917 回答