diff --git a/source/Grabacr07.KanColleViewer/Application.Static.cs b/source/Grabacr07.KanColleViewer/Application.Static.cs index 55c0a3487..03af1aa4c 100644 --- a/source/Grabacr07.KanColleViewer/Application.Static.cs +++ b/source/Grabacr07.KanColleViewer/Application.Static.cs @@ -19,7 +19,7 @@ partial class Application { static Application() { - AppDomain.CurrentDomain.UnhandledException += (sender, args) => ReportException(sender, args.ExceptionObject as Exception); + AppDomain.CurrentDomain.UnhandledException += (sender, args) => ReportException("AppDomain", sender, args.ExceptionObject as Exception); TelemetryClient = new TelemetryClient(); TelemetryClient.Context.Session.Id = Guid.NewGuid().ToString(); @@ -73,29 +73,29 @@ private static bool BootstrapProxy() return vmodel.DialogResult; } - private static void ReportException(object sender, Exception exception) + private static void ReportException(string caller, object sender, Exception exception) { - var now = DateTimeOffset.Now; - var path = Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), - ProductInfo.Company, - ProductInfo.Product, - "ErrorReports", - $"ErrorReport-{now:yyyyMMdd-HHmmss}-{now.Millisecond:000}.log"); - - var message = $@"*** Error Report *** + try + { + var now = DateTimeOffset.Now; + var path = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + ProductInfo.Company, + ProductInfo.Product, + "ErrorReports", + $"ErrorReport-{now:yyyyMMdd-HHmmss}-{now.Millisecond:000}.log"); + + var message = $@"*** Error Report ({caller}) *** {ProductInfo.Product} ver.{ProductInfo.VersionString} -{DateTimeOffset.Now} +{now} {new SystemEnvironment()} -Sender: {sender.GetType().FullName} -Exception: {exception.GetType().FullName} +Sender: {(sender is Type t ? t : sender?.GetType())?.FullName} +Exception: {exception?.GetType().FullName} {exception} "; - try - { // ReSharper disable once AssignNullToNotNullAttribute Directory.CreateDirectory(Path.GetDirectoryName(path)); File.AppendAllText(path, message); diff --git a/source/Grabacr07.KanColleViewer/Application.xaml.cs b/source/Grabacr07.KanColleViewer/Application.xaml.cs index 906f85117..647175c88 100644 --- a/source/Grabacr07.KanColleViewer/Application.xaml.cs +++ b/source/Grabacr07.KanColleViewer/Application.xaml.cs @@ -69,7 +69,7 @@ protected override void OnStartup(StartupEventArgs e) { this.DispatcherUnhandledException += (sender, args) => { - ReportException(sender, args.Exception); + ReportException("Dispatcher", sender, args.Exception); args.Handled = true; }; diff --git a/source/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs b/source/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs index 4e6d9b8db..a8f20f126 100644 --- a/source/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs +++ b/source/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs @@ -15,4 +15,4 @@ ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] -[assembly: AssemblyVersion("4.5.0.2")] +[assembly: AssemblyVersion("4.5.1")] diff --git a/source/Grabacr07.KanColleViewer/Views/KanColleWindow.xaml.cs b/source/Grabacr07.KanColleViewer/Views/KanColleWindow.xaml.cs index 36e999dc8..318877cf5 100644 --- a/source/Grabacr07.KanColleViewer/Views/KanColleWindow.xaml.cs +++ b/source/Grabacr07.KanColleViewer/Views/KanColleWindow.xaml.cs @@ -47,12 +47,12 @@ private void ChangeSizeByBrowser(Size browserSize) if (this.previousDock == Dock.Top || this.previousDock == Dock.Bottom) { var diffW = this.previousBrowserSize.Value.Width - browserSize.Width; - if (Math.Abs(diffW) > 0.00001) this.Width -= diffW; + if (Math.Abs(diffW) > 0.00001 && this.Width - diffW > 0) this.Width -= diffW; } else if (this.previousDock == Dock.Left || this.previousDock == Dock.Right) { var diffH = this.previousBrowserSize.Value.Height - browserSize.Height; - if (Math.Abs(diffH) > 0.00001) this.Height -= diffH; + if (Math.Abs(diffH) > 0.00001 && this.Height - diffH > 0) this.Height -= diffH; } } else