NBug配置问题

时间:2017-05-18 16:08:22

标签: c# winforms nbug

关于NBug的两个问题:

  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;
          }
          [...]
    }
    

1 个答案:

答案 0 :(得分:1)

  1. 看起来不错,应该能很好地运作。
  2. 如果您从源代码编译,请在此处设置一个断点,看看会发生什么:https://github.com/soygul/NBug/blob/d48942b844f3ea2a6e90b993f4c63565e0426944/NBug/Core/Submission/Custom/Custom.cs#L44
  3. 如果您正在使用nuget包,它已经过时,可能无效。