Esempio n. 1
0
 public static void ClearArchivedDumpFiles(string path)
 {
     if (!Directory.Exists(path))
     {
         MiniDumpProvider._tracer.TraceInformation("No dump file directory");
     }
     else
     {
         foreach (string file in Directory.GetFiles(path, "*.dmp", SearchOption.TopDirectoryOnly))
         {
             using (LogicalOperation.Create(string.Format("Deleting {0}", (object)file), new object[0]))
             {
                 try
                 {
                     File.Delete(file);
                     MiniDumpProvider._tracer.TraceInformation(string.Format("Removed"));
                 }
                 catch (Exception ex)
                 {
                     MiniDumpProvider._tracer.TraceInformation(string.Format("Error: {0}", (object)ex));
                 }
             }
         }
     }
 }
Esempio n. 2
0
 protected override void OnStop()
 {
     using (LogicalOperation.Create("Stopping Oculi Service", new object[0]))
     {
         try
         {
             this.loader.Unload();
         }
         catch (Exception ex)
         {
             this.logger.Critical(ex, "Unhandled exception while unloading the Oculi Service");
             throw;
         }
     }
 }
Esempio n. 3
0
 protected override void OnStart(string[] args)
 {
     ThreadPool.QueueUserWorkItem((WaitCallback)(param0 =>
     {
         this.Initialize();
         using (LogicalOperation.Create("Starting Oculi Service", new object[0]))
         {
             try
             {
                 this.loader.Load();
             }
             catch (Exception ex)
             {
                 this.logger.Critical(ex, "Unhandled exception while loading the Oculi Service");
                 throw;
             }
         }
     }));
 }
Esempio n. 4
0
 private void AppDomainUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
 {
     if (!e.IsTerminating)
     {
         return;
     }
     using (LogicalOperation.Create(string.Format("An unhandled exception occurred in AppDomain: [{0}]", (object)AppDomain.CurrentDomain.FriendlyName), new object[0]))
     {
         try
         {
             if (e != null && e.ExceptionObject != null)
             {
                 if (e.ExceptionObject is Exception)
                 {
                     this.loader.Logger.Critical((Exception)e.ExceptionObject);
                 }
                 else
                 {
                     this.loader.Logger.Critical("Unknown error: " + e.ExceptionObject.ToString());
                 }
             }
             else
             {
                 this.loader.Logger.Critical("Malformed unknown error");
             }
         }
         finally
         {
             string filepath = Path.Combine(OculiService.PersistencePath, string.Format(OculiService.MiniDumpFormatString, (object)DateTime.UtcNow.ToString("yyyy_MM_dd_HH_mm_ss")));
             using (LogicalOperation.Create(string.Format("Writing crash dump to: [{0}]", (object)filepath), new object[0]))
             {
                 int num = MiniDumpProvider.Write(filepath);
                 if (num != 0)
                 {
                     this.loader.Logger.Critical(string.Format("Failed to write crash dump with error code: {0}", (object)num));
                 }
                 this.loader.Logger.Verbose("Crash dump written successfully");
             }
         }
     }
 }