From 8fba47cbeb39029e98a6a21f9ecb3dbf3c1f9c7d Mon Sep 17 00:00:00 2001 From: Lorenz Cuno Klopfenstein Date: Sun, 20 Jun 2010 02:01:04 +0200 Subject: [PATCH] Added fatal exception handler with error dump on desktop. --- OnTopReplica/MainForm.cs | 9 +++++---- OnTopReplica/OnTopReplica.csproj | 14 +++++++++++-- OnTopReplica/Program.cs | 27 +++++++++++++++++++++++++ OnTopReplica/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/OnTopReplica/MainForm.cs b/OnTopReplica/MainForm.cs index b68580b..5bdb7d1 100644 --- a/OnTopReplica/MainForm.cs +++ b/OnTopReplica/MainForm.cs @@ -6,10 +6,10 @@ using OnTopReplica.Properties; using VistaControls.Dwm; using VistaControls.TaskDialog; -namespace OnTopReplica -{ - public partial class MainForm : AspectRatioForm - { +namespace OnTopReplica { + + public partial class MainForm : AspectRatioForm { + //Visualization status bool _clickForwarding = false; @@ -33,6 +33,7 @@ namespace OnTopReplica public MainForm(Point location, Size size) : this() { + _startOverride = true; _startLocation = location; _startSize = size; diff --git a/OnTopReplica/OnTopReplica.csproj b/OnTopReplica/OnTopReplica.csproj index 89baf3e..716333b 100644 --- a/OnTopReplica/OnTopReplica.csproj +++ b/OnTopReplica/OnTopReplica.csproj @@ -49,8 +49,8 @@ true publish.htm false - 1 - 2.9.4.%2a + 2 + 2.9.5.%2a false true true @@ -304,6 +304,16 @@ True Satellite + + False + + + + + Include + True + Satellite + False diff --git a/OnTopReplica/Program.cs b/OnTopReplica/Program.cs index cb70cd4..04760eb 100644 --- a/OnTopReplica/Program.cs +++ b/OnTopReplica/Program.cs @@ -5,6 +5,7 @@ using OnTopReplica.Properties; using System.Threading; using System.Globalization; using System.Drawing; +using System.IO; namespace OnTopReplica { @@ -14,6 +15,9 @@ namespace OnTopReplica /// [STAThread] static void Main() { + //Hook abort handler + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + //Update settings if needed if (Settings.Default.MustUpdate) { Settings.Default.Upgrade(); @@ -70,5 +74,28 @@ namespace OnTopReplica return true; } + + static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { + string dump = string.Format("OnTopReplica-dump-{0}{1}{2}{3}{4}.txt", + DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, + DateTime.UtcNow.Hour, DateTime.UtcNow.Minute); + string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), dump); + + using (var s = new FileStream(path, FileMode.Create)) { + using (var sw = new StreamWriter(s)) { + sw.WriteLine("OnTopReplica Dump file"); + sw.WriteLine("This file has been created because OnTopReplica crashed."); + sw.WriteLine("Please send it to lck@klopfenstein.net to help fix the bug that caused the crash."); + sw.WriteLine(); + sw.WriteLine("Last exception:"); + sw.WriteLine(e.ExceptionObject.ToString()); + sw.WriteLine(); + sw.WriteLine("OS: {0}", Environment.OSVersion.ToString()); + sw.WriteLine(".NET: {0}", Environment.Version.ToString()); + sw.WriteLine("Aero DWM: {0}", VistaControls.OsSupport.IsCompositionEnabled); + } + } + } + } } diff --git a/OnTopReplica/Properties/AssemblyInfo.cs b/OnTopReplica/Properties/AssemblyInfo.cs index 82310c8..4848486 100644 --- a/OnTopReplica/Properties/AssemblyInfo.cs +++ b/OnTopReplica/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.9.4.0")] -[assembly: AssemblyFileVersion("2.9.4.0")] +[assembly: AssemblyVersion("2.9.5.0")] +[assembly: AssemblyFileVersion("2.9.5.0")]