Пример #1
0
        public virtual void Process(Exception ex, ILogger logger)
        {
            try {
                Guid   dumpGuid = Guid.NewGuid();
                string fileName = dumpGuid.ToString() + ".dmp";
                fileName = Path.Combine(Path.GetTempPath(), fileName);
                if (MiniDumpWriter.Write(fileName, MiniDumpType.Normal))
                {
                    byte[] content = File.ReadAllBytes(fileName);
                    try {
                        File.Delete(fileName);
                    }
                    catch {
                    }

                    Attachment attach = new Attachment();
                    attach.Content  = content;
                    attach.MimeType = "application/vnd.tcpdump.pcap";
                    attach.Name     = "miniDump.dmp";

                    logger.Data[DumpAttachKey] = attach;
                }
            }
            catch {
            }
        }
Пример #2
0
 void WriteMiniDumpExternally(Exception ex, ILogger logger)
 {
     logger.BeginWriteObject("miniDump");
     try {
         Guid   dumpGuid = Guid.NewGuid();
         string fileName = dumpGuid.ToString() + ".dmp";
         fileName = Path.Combine(Path.GetTempPath(), fileName);
         if (MiniDumpWriter.Write(fileName, MiniDumpType.Normal))
         {
             logger.WriteValue("dumpGuid", dumpGuid.ToString());
             logger.Data[DumpGuidKey]     = dumpGuid.ToString();
             logger.Data[DumpFileNameKey] = fileName;
         }
     }
     catch {
     }
     finally {
         logger.EndWriteObject("miniDump");
     }
 }