示例#1
0
        public void UnhandledException(Exception aException)
        {
            bool firstException = !iErrorThrown;

            lock (iLock)
            {
                if (!iErrorThrown)
                {
                    iErrorThrown = true;

                    // create and dump the crash log
                    CrashLog cl = new CrashLog(aException, iOptionManager);
                    foreach (ICrashLogDumper d in iCrashLogDumpers)
                    {
                        d.Dump(cl);
                    }
                }
            }

            // notify
            if (firstException && EventErrorOccurred != null)
            {
                EventErrorOccurred(this, EventArgs.Empty);
            }
        }
示例#2
0
文件: Debug.cs 项目: daviddw/Kinsky
 public void Dump(CrashLog aCrashLog)
 {
     try
     {
         StreamWriter f = new StreamWriter(iFilename);
         f.Write(aCrashLog.ToString());
         f.Close();
     }
     catch (System.UnauthorizedAccessException)
     {
         //if no permissions to write to log file
     }
     catch (Exception)
     {
         Console.WriteLine("Unhandled Exception - cannot write to log file:");
         Console.WriteLine(aCrashLog.ToString());
     }
 }
示例#3
0
文件: Helper.cs 项目: daviddw/Kinsky
        public void UnhandledException(Exception aException)
        {
            bool firstException = !iErrorThrown;

            lock (iLock)
            {
                if (!iErrorThrown)
                {
                    iErrorThrown = true;

                    // create and dump the crash log
                    CrashLog cl = new CrashLog(aException, iOptionManager);
                    foreach (ICrashLogDumper d in iCrashLogDumpers)
                    {
                        d.Dump(cl);
                    }

                    if (Insights.IsInitialized)
                    {
                        var data = new Dictionary <string, string> {
                            { "Logs", UserLog.Text }
                        };
                        string options = string.Empty;
                        foreach (var o in iOptionManager.OptionValues)
                        {
                            options += string.Format("{0} : {1}\n", o.Key, o.Value);
                        }
                        data.Add("Options", options);
                        Insights.Report(aException, data, Xamarin.Insights.Severity.Error);
                        Insights.PurgePendingCrashReports().Wait();
                    }
                }
            }

            // notify
            if (firstException && EventErrorOccurred != null)
            {
                EventErrorOccurred(this, EventArgs.Empty);
            }
        }
示例#4
0
文件: Debug.cs 项目: daviddw/Kinsky
 public void Dump(CrashLog aCrashLog)
 {
     // For dumping to stdout, just write the exception
     Console.WriteLine(aCrashLog.Exception.ToString());
 }