コード例 #1
0
ファイル: CrashDumper.cs プロジェクト: daviddw/oss-public
 public void Dump(CrashLog aCrashLog)
 {
     try
     {
         if (iOptionPage.AutoSend)
         {
             Send(aCrashLog.ToString(), iHelper.Product, iHelper.Version, iHelper.Title);
         }
         else
         {
             NotificationManager notificationManager = (NotificationManager)iContext.GetSystemService(Context.NotificationService);
             Notification        notification        = new Notification(iNotificationIconResource, string.Format("{0} has quit unexpectedly.", iHelper.Product));
             Intent notificationIntent = new Intent(iContext, typeof(CrashReportActivity));
             Bundle b = new Bundle();
             b.PutString(kCrashLogData, aCrashLog.ToString());
             b.PutInt(kCrashLogImage, iNotificationIconResource);
             notificationIntent.PutExtras(b);
             PendingIntent pendingIntent = PendingIntent.GetActivity(iContext, 0, notificationIntent, PendingIntentFlags.UpdateCurrent);
             notification.SetLatestEventInfo(iContext, string.Format("{0} has quit unexpectedly.", iHelper.Product), string.Format("{0} has encountered a problem and had to close.", iHelper.Product), pendingIntent);
             notificationManager.Notify((int)ENotificationType.SystemCrash, notification);
         }
     }
     catch (Exception ex)
     {
         UserLog.WriteLine("Unhandled exception in CrashDumper.Dump: " + ex);
     }
 }
コード例 #2
0
 public IActionResult Post([FromBody] CrashLog newLog)
 {
     using (TeamContext context = new TeamContext())
     {
         context.CrashLogs.Add(newLog);
         context.SaveChanges();
     }
     return(Created("/User", Log()));
 }
コード例 #3
0
        public void Dump(CrashLog aCrashLog)
        {
            iReportText = aCrashLog.ToString();

            Dispatcher.Invoke((System.Windows.Forms.MethodInvoker) delegate()
            {
                // show crash form
                textBoxDetails.Text = iReportText;
                ShowDialog();
            });
        }
コード例 #4
0
 public void Dump(CrashLog aCrashLog)
 {
     try
     {
         iParent.Visibility = Visibility.Hidden;
         // include some system details in report
         iReportText = aCrashLog.ToString();
         iWaitHandle = new ManualResetEvent(false);
         iShowCrashLogDialog.Start();
         iWaitHandle.WaitOne();
     }catch (Exception ex) {
         UserLog.WriteLine("Unhandled exception in CrashLogDumper.Dump() " + ex);
     }
 }
コード例 #5
0
        public void Dump(CrashLog aCrashLog)
        {
            // include some system details in report
            string reportText = aCrashLog.ToString();
            // show crash form
            FormCrashLogDumper form   = new FormCrashLogDumper(iTitle, iIcon, reportText);
            DialogResult       result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                // post data to Linn
                DebugReport report = new DebugReport("Crash log generated by " + iProduct + " ver " + iVersion);
                report.Post(iTitle, reportText);
            }
        }
コード例 #6
0
        static void PrepareReport(Exception e)
        {
            ErrorMsg = "----------------------------------------------------------------------------------------------------------------------" + "\n" +
                       "Unhandled Exception " + "\n" +
                       "----------------------------------------------------------------------------------------------------------------------" + "\n" +
                       e.Message + "\n" +
                       "----------------------------------------------------------------------------------------------------------------------" + "\n\n";

            StackTraceMsg = "----------------------------------------------------------------------------------------------------------------------" + "\n" +
                            "Call Stack " + "\n" +
                            "----------------------------------------------------------------------------------------------------------------------" + "\n" +
                            e.StackTrace + "\n" +
                            "----------------------------------------------------------------------------------------------------------------------" + "\n\n";


            HardwareData += "----------------------------------------------------------------------------------------------------------------------" + "\n";
            HardwareData += "CPU" + "\n";
            HardwareData += "----------------------------------------------------------------------------------------------------------------------";
            HardwareData += SystemInfo.GetCPU;

            HardwareData += "\n\n" + "----------------------------------------------------------------------------------------------------------------------" + "\n";
            HardwareData += "RAM" + "\n";
            HardwareData += "----------------------------------------------------------------------------------------------------------------------";
            HardwareData += SystemInfo.GetRAM;

            HardwareData += "\n\n" + "----------------------------------------------------------------------------------------------------------------------" + "\n";
            HardwareData += "GPU" + "\n";
            HardwareData += "----------------------------------------------------------------------------------------------------------------------";
            HardwareData += SystemInfo.GetGPU;

            HardwareData += "\n\n" + "----------------------------------------------------------------------------------------------------------------------" + "\n";
            HardwareData += "Sound Device" + "\n";
            HardwareData += "----------------------------------------------------------------------------------------------------------------------";
            HardwareData += SystemInfo.GetSoundDevice;

            HardwareData += "\n\n" + "----------------------------------------------------------------------------------------------------------------------" + "\n";
            HardwareData += "Get Network Adapter" + "\n";
            HardwareData += "----------------------------------------------------------------------------------------------------------------------";
            HardwareData += SystemInfo.GetNetworkAdapter;

            HardwareData += "\n\n" + "----------------------------------------------------------------------------------------------------------------------" + "\n";
            HardwareData += "The end of the report" + "\n";
            HardwareData += "----------------------------------------------------------------------------------------------------------------------";

            CrashLog = ErrorMsg + StackTraceMsg + HardwareData;

            CrashLog = CrashLog.Replace("&", "and");
        }
コード例 #7
0
ファイル: CrashLogDumper.cs プロジェクト: daviddw/oss-public
        public void Dump(CrashLog aCrashLog)
        {
            // include some system details in report
            string reportText = aCrashLog.ToString();

            DebugReport report = new DebugReport("Crash log generated by " + iProduct + " ver " + iVersion);

            /*iDelegate = new Delegate(report, iTitle, reportText);
             * UIAlertView alert = new UIAlertView(iTitle, "The application " + iTitle + " quit unexpectedly", iDelegate,
             *                                  "Close", new string[] { "Report and Close" });
             * alert.Show();*/

            if (iAutoSend)
            {
                report.Post(iTitle, reportText);
            }
        }
コード例 #8
0
        public void Dump(CrashLog aCrashLog)
        {
            int result = AppKitFramework.NSRunCriticalAlertPanel("The application " + iTitle + " quit unexpectedly",
                                                                 "Mac OS X and other applications are not affected.\n\n" +
                                                                 "Click Report to send a report to Linn",
                                                                 "Report",
                                                                 "Ignore",
                                                                 null);

            // show crash form
            if (result == 1)
            {
                // post data to Linn
                DebugReport report = new DebugReport("Crash log generated by " + iProduct + " ver " + iVersion);
                report.Post(iTitle, aCrashLog.ToString());
            }
        }
コード例 #9
0
        public void Dump(CrashLog aCrashLog)
        {
            InvokeOnMainThread(delegate {
                iReportText      = aCrashLog.ToString();
                Details.Editable = true;
                Details.InsertText(new NSString(iReportText));
                Details.ScrollRangeToVisible(new NSRange(0, 0));
                Details.SetSelectedRange(new NSRange(0, 0));
                Details.Editable = false;

                // show the window modally
                Window.Center();
                Window.MakeKeyAndOrderFront(this);

                NSApplication.SharedApplication.RunModalForWindow(Window);

                Window.OrderOut(this);
            });
        }
コード例 #10
0
ファイル: App.xaml.cs プロジェクト: soiOL/hello
        private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var log = new CrashLog(e.Exception.ToString(), e.Exception.HResult, e.Exception.StackTrace, e.Exception.Source, e.Exception.Message);

            e.Handled = true;
            if (e.Exception.HResult == -2147418113 || e.Exception.HResult.ToHexString() == "0x80070057")
            {
                return;
            }
            if (settings.Preferences.EnableCrashReport)
            {
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, new DispatchedHandler(() =>
                {
                    Window.Current.Content = null;
                    var f = new Frame();
                    f.Navigate(typeof(CrashReportPage), log);
                    Window.Current.Content = f;
                }));
            }
        }
コード例 #11
0
ファイル: FileIOHelper.cs プロジェクト: hezlog/Aurora.Music
        public static async Task <StorageFile> AppendLogtoCacheAsync(CrashLog exception, string name = "crashLOG")
        {
            var cache = ApplicationData.Current.LocalCacheFolder;
            var log   = await cache.CreateFileAsync(name, CreationCollisionOption.OpenIfExists);

            var sb   = new StringBuilder(DateTime.Now.ToString("G") + Environment.NewLine);
            var info = SystemInfoHelper.GetSystemInfo();

            foreach (var i in info)
            {
                sb.Append(i + Environment.NewLine);
            }
            sb.Append("Error Code = " + exception.HResult.ToHexString() + Environment.NewLine);
            sb.Append("Exception = " + exception.Exception + Environment.NewLine);
            sb.Append("Message = " + exception.Message + Environment.NewLine);
            sb.Append("StackTrace = " + exception.StackTrace + Environment.NewLine);
            sb.Append("Source = " + exception.Source + Environment.NewLine);
            await FileIO.AppendTextAsync(log, sb.ToString());

            return(log);
        }
コード例 #12
0
 public void Dump(CrashLog aCrashLog)
 {
 }
コード例 #13
0
ファイル: DeviceViewModel.cs プロジェクト: intvsteve/VINTage
        private void GetDeviceErrorAndCrashLogsComplete(ErrorLog errorLog, CrashLog crashLog)
        {
            var hasErrorLog = (errorLog != null) && !errorLog.IsEmpty;
            var hasCrashLog = crashLog != null;

            if (hasErrorLog || hasCrashLog)
            {
                var reportText = (new System.Text.StringBuilder(Resources.Strings.CrashReporter_DetailHeader)).AppendLine();
                if (Device != null)
                {
                    reportText.AppendLine("Device Primary Firmware Version: " + FirmwareRevisions.FirmwareVersionToString(Device.FirmwareRevisions.Primary, false));
                    reportText.AppendLine("Device Secondary Firmware Version: " + FirmwareRevisions.FirmwareVersionToString(Device.FirmwareRevisions.Secondary, false));
                    reportText.AppendLine("Device Current Firmware Version: " + FirmwareRevisions.FirmwareVersionToString(Device.FirmwareRevisions.Current, false));
                }
                else
                {
                    reportText.AppendLine("Device firmware versions unavailable");
                }
                reportText.AppendLine(Resources.Strings.CrashReporter_Detail_DeviceId + " " + Device.UniqueId);
                var timestamp = PathUtils.GetTimeString(true);
                reportText.AppendLine(Resources.Strings.CrashReporter_Detail_Timestamp + " " + timestamp);
                var errorReportFiles = new List <string>();
                if (hasCrashLog)
                {
                    var crashLogFileName = string.Empty;
                    try
                    {
                        System.IO.Directory.CreateDirectory(Configuration.Instance.ErrorLogDirectory);
                        crashLogFileName = PathUtils.EnsureUniqueFileName(System.IO.Path.Combine(Configuration.Instance.ErrorLogDirectory, CrashLog.CrashLogFileName));
                        using (var crashLogFile = System.IO.File.Create(crashLogFileName))
                        {
                            using (var writer = new ASCIIBinaryWriter(crashLogFile))
                            {
                                crashLog.Serialize(writer);
                            }
                        }
                        errorReportFiles.Add(crashLogFileName);
                    }
                    catch (System.Exception)
                    {
                        // We got an error trying to write the error log...
                    }
                    finally
                    {
                        if (!System.IO.File.Exists(crashLogFileName))
                        {
                            crashLogFileName = Resources.Strings.CrashReporter_Detail_CrashLogUnavailable;
                        }
                    }
                    reportText.AppendLine().AppendFormat(Resources.Strings.CrashReporter_Detail_FirmwareCrashFormat, crashLogFileName);
                }
                if (hasErrorLog)
                {
                    if (hasCrashLog)
                    {
                        reportText.AppendLine();
                    }
                    var errorLogFileName = string.Empty;
                    try
                    {
                        System.IO.Directory.CreateDirectory(Configuration.Instance.ErrorLogDirectory);
                        errorLogFileName = PathUtils.EnsureUniqueFileName(System.IO.Path.Combine(Configuration.Instance.ErrorLogDirectory, "ErrorLog.txt"));
                        using (var errorLogFile = System.IO.File.Create(errorLogFileName))
                        {
                            using (var writer = new ASCIIBinaryWriter(errorLogFile))
                            {
                                errorLog.SerializeToTextFile(Device.FirmwareRevisions.Current, writer);
                            }
                        }
                        errorReportFiles.Add(errorLogFileName);
                    }
                    catch (System.Exception)
                    {
                        // TODO Really? All exceptions? Perhaps be a bit more selective here.
                    }
                    finally
                    {
                        if (!System.IO.File.Exists(errorLogFileName))
                        {
                            errorLogFileName = Resources.Strings.CrashReporter_Detail_ErrorLogUnavailable;
                        }
                    }
                    var errorLogText = errorLog.GetDetailedErrorReport(Device.FirmwareRevisions.Current);
                    reportText.AppendLine().AppendFormat(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.CrashReporter_Detail_ErrorLogFormat, errorLogText, errorLogFileName);
                }
                var title        = Resources.Strings.CrashReporter_Title;
                var message      = Resources.Strings.CrashReporter_Message;
                var reportDialog = ReportDialog.Create(title, message);
                reportDialog.TextWrapping = OSTextWrapping.Wrap;
                reportDialog.ReportText   = reportText.ToString();
                errorReportFiles.ForEach(f => reportDialog.Attachments.Add(f));
                if (hasErrorLog || hasCrashLog)
                {
                    var cc = new List <string>();
                    cc.Add("*****@*****.**");
                    reportDialog.EmailCCRecipients = cc;
                }
                reportDialog.ShowDialog(Resources.Strings.Close);
            }
        }
コード例 #14
0
        /// <summary>
        /// Loads the game information.
        /// </summary>
        private static void LoadGameInfo()
        {
            Main.Log.AppendLine("Loading game library.");
            List <FileInfo> found = new List <FileInfo>();
            DirectoryInfo   dir   = new DirectoryInfo("Data\\NetScriptFramework");
            var             files = dir.GetFiles();

            foreach (var x in files)
            {
                string fileName = x.Name;
                if (!fileName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || !fileName.StartsWith(Main.FrameworkName + ".", StringComparison.OrdinalIgnoreCase) || fileName.Equals(Main.FrameworkName + ".dll", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                fileName = fileName.Substring(Main.FrameworkName.Length + 1);
                fileName = fileName.Substring(0, fileName.Length - 4);

                if (fileName.Length == 0 || fileName.Equals("Runtime", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                found.Add(x);
            }

            if (found.Count == 0)
            {
                Main.Log.AppendLine("No game library found! Game definitions will not be loaded but plugins may still load.");
                return;
            }

            if (found.Count > 1)
            {
                string fstr = string.Join(", ", found.Select(q => q.Name));
                throw new InvalidOperationException("Found more than one game library DLL! Only one game library may be active at a time. [" + fstr + "]");
            }

            {
                var    debugFile     = found[0];
                string debugFileName = debugFile.Name;
                int    ptIdx         = debugFileName.LastIndexOf('.');
                if (ptIdx >= 0)
                {
                    debugFileName = debugFileName.Substring(0, ptIdx) + ".bin";
                    debugFile     = new FileInfo(System.IO.Path.Combine(debugFile.DirectoryName, debugFileName));
                    CrashLog._FileForDebugInfo = debugFile;
                    CrashLog.InitializeDebug();
                }
            }

            System.Reflection.Assembly assembly = null;
            Loader.Load(found[0], ref assembly);
            if (assembly == null)
            {
                throw new InvalidOperationException();
            }

            var  types = assembly.GetTypes();
            Type valid = null;

            foreach (var t in types)
            {
                if (!t.IsSubclassOf(typeof(Game)))
                {
                    continue;
                }

                if (t.IsAbstract)
                {
                    continue;
                }

                if (t.BaseType != typeof(Game))
                {
                    continue;
                }

                if (valid != null)
                {
                    throw new InvalidOperationException("Found more than one valid game header type!");
                }

                valid = t;
            }

            if (valid == null)
            {
                throw new InvalidOperationException("Found game library but no valid game header type!");
            }

            GameCreate = 1;
            Main._is_initializing_plugin += 2;
            try
            {
                Game   result = (Game)Activator.CreateInstance(valid);
                string print  = "`" + result.FullName + "` (" + result.LibraryVersion + ")";
                Main.Log.AppendLine("Loaded game library for " + print + ".");
                Main.Log.AppendLine("Running game version is " + string.Join(".", result.GameVersion));
                string supportedExecutable = result.ExecutableName;
                string haveExecutable      = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName;
                if (!haveExecutable.Equals(supportedExecutable, StringComparison.OrdinalIgnoreCase))
                {
                    throw new InvalidOperationException("Game library " + print + " expected game executable `" + supportedExecutable + "` but have `" + haveExecutable + "`!");
                }
                if (!result.IsValidVersion)
                {
                    throw new InvalidOperationException("Game library " + print + " does not support game version " + string.Join(".", result.GameVersion) + "!");
                }
                Main.Game = result;
                result._initialize();
            }
            finally
            {
                Main._is_initializing_plugin -= 2;
            }
        }
コード例 #15
0
        /// <summary>
        /// Unhandled exception filter.
        /// </summary>
        /// <param name="cpu">The cpu context.</param>
        /// <returns></returns>
        internal static bool UnhandledExceptionFilter(CPURegisters cpu)
        {
            int    handled = 0;
            string logmsg  = "Unhandled native exception occurred at " + cpu.IP.ToHexString() + CrashLog.GetAddressInModule(cpu.IP, System.Diagnostics.Process.GetCurrentProcess().Modules, " ") + " on thread " + Memory.GetCurrentNativeThreadId() + "!";

            try
            {
                var cl = new NativeCrashLog(cpu);
                handled = cl.Write(true);

                if (cl.Skipped)
                {
                    logmsg = null;
                }
            }
            catch (Exception ex2)
            {
                Main.Log.Append(ex2);
            }

            if (logmsg != null)
            {
                Log.AppendLine(logmsg);
            }

            return(handled > 0);
        }
コード例 #16
0
 private static void GetErrorAndCrashLogsComplete(INTV.LtoFlash.Model.ErrorLog errorLog, CrashLog crashLog)
 {
     System.Diagnostics.Debug.WriteLine("Got logs");
 }
コード例 #17
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     crash = e.Parameter as CrashLog;
 }