示例#1
0
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string dir = AppDomain.CurrentDomain.BaseDirectory + "\\Logs\\ErrorInfo\\";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            string path = dir + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + "_Error.txt";

            File.WriteAllText(path, "App.CurrentDomain_UnhandledException:" + e.ExceptionObject + "");
            //Log.Error("App.CurrentDomain_UnhandledException", e.ExceptionObject + "");

            string path2 = string.Format("{0}{1}_0.dmp", dir, DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"));

            MiniDump.TryDump(path2, MiniDumpType.None);
            string path3 = string.Format("{0}{1}_1.dmp", dir, DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"));

            MiniDump.TryDump(path3, MiniDumpType.WithFullMemory);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "None"), MiniDumpType.None);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "Normal"), MiniDumpType.Normal);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "WithDataSegs"), MiniDumpType.WithDataSegs);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "WithCodeSegs"), MiniDumpType.WithCodeSegs);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "WithHandleData"), MiniDumpType.WithHandleData);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "FilterMemory"), MiniDumpType.FilterMemory);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "ScanMemory"), MiniDumpType.ScanMemory);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "WithThreadInfo"), MiniDumpType.WithThreadInfo);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "WithFullMemoryInfo"), MiniDumpType.WithFullMemoryInfo);
            //MiniDump.TryDump(string.Format("{0}{1}.dmp", dir, "WithFullMemory"), MiniDumpType.WithFullMemory);
        }
示例#2
0
        /// <summary>写当前线程的MiniDump</summary>
        /// <param name="dumpFile">如果不指定,则自动写入日志目录</param>
        public static void WriteMiniDump(String dumpFile)
        {
            if (String.IsNullOrEmpty(dumpFile))
            {
                dumpFile = String.Format("{0:yyyyMMdd_HHmmss}.dmp", DateTime.Now);
                if (!String.IsNullOrEmpty(LogPath))
                {
                    dumpFile = Path.Combine(LogPath, dumpFile);
                }
            }

            MiniDump.TryDump(dumpFile, MiniDump.MiniDumpType.WithFullMemory);
        }
示例#3
0
文件: MainForm.cs 项目: radtek/qsw
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex = e.ExceptionObject as Exception;

            LogUtil.Error(ex.Message);
            LogUtil.Error(ex.StackTrace);
            string dateStr = DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss");
            var    option  = MiniDump.Option.WithFullMemory | MiniDump.Option.WithHandleData |
                             MiniDump.Option.WithUnloadedModules | MiniDump.Option.WithProcessThreadData |
                             MiniDump.Option.WithThreadInfo;

            MiniDump.TryDump(string.Format("log\\QSWMaintain_{0}.dmp", dateStr), option);
        }
示例#4
0
        public App()
        {
            try
            {
                InitializeComponent();
                InitException();
                //  this.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
                Startup += Application_Startup;
                Exit    += Application_Exit;

                // ThemesHelper.InitResource();

                ThemesHelper.InitSkinData();

                ThemesHelper.SetSkin("Default");
            }
            catch (Exception ex)
            {
                LogHelper.Instance.WirteErrorMsg(string.Format("App Error,Msg:{0}", ex.Message));
                LogHelper.Instance.WirteErrorMsg(string.Format("App Error,Msg:{0}", ex.StackTrace));
                MiniDump.TryDump(String.Format("{0}MiniDmp.dmp", DateTime.Now.ToString()));
            }
        }