diff --git a/gui/App.xaml b/gui/App.xaml index 422f541c..1139639d 100644 --- a/gui/App.xaml +++ b/gui/App.xaml @@ -3,7 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Profiler.App" xmlns:local="clr-namespace:Profiler" - x:Name="Optick"> + x:Name="Optick" + DispatcherUnhandledException="Optick_DispatcherUnhandledException"> diff --git a/gui/App.xaml.cs b/gui/App.xaml.cs index ddd39e57..2ade8441 100644 --- a/gui/App.xaml.cs +++ b/gui/App.xaml.cs @@ -3,7 +3,8 @@ using System.Reflection; using System.IO; using System.Diagnostics; - +using Sentry; + namespace Profiler { /// @@ -14,19 +15,42 @@ public partial class App : Application static App() { - //AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve); - } - - //static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) - //{ - // return AutoEmbedLibs.EmbeddedAssembly.Get(args.Name); - //} + + } protected override void OnStartup(StartupEventArgs e) { - base.OnStartup(e); - } - - - } + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + base.OnStartup(e); + } + + private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + Exception ex = e.ExceptionObject as Exception; + ReportError(ex); + } + + private void Optick_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) + { + e.Handled = ReportError(e.Exception); + } + + bool ReportError(Exception ex) + { + Exception rootException = ex; + + while (rootException.InnerException != null) + rootException = rootException.InnerException; + + if (MessageBox.Show("Unhandled Exception:\n" + rootException.ToString(), "Optick Crashed! Send report?", MessageBoxButton.OKCancel, MessageBoxImage.Error) == MessageBoxResult.OK) + { + using (SentrySdk.Init("https://52c8ab53c0cf47f28263fc211ebd4d38@sentry.io/1493349")) + { + SentrySdk.CaptureException(rootException); + } + return true; + } + return false; + } + } } diff --git a/gui/Optick.csproj b/gui/Optick.csproj index d8590bfa..6af07d6e 100644 --- a/gui/Optick.csproj +++ b/gui/Optick.csproj @@ -175,6 +175,15 @@ packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + + packages\Sentry.1.2.0\lib\net461\Sentry.dll + + + packages\Sentry.PlatformAbstractions.1.0.0\lib\net45\Sentry.PlatformAbstractions.dll + + + packages\Sentry.Protocol.1.0.6\lib\net46\Sentry.Protocol.dll + AutoEmbedLibs\SharpDX.dll @@ -191,10 +200,18 @@ AutoEmbedLibs\SharpDX.DXGI.dll + + packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll + + + packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + True + diff --git a/gui/Properties/AssemblyInfo.cs b/gui/Properties/AssemblyInfo.cs index f9b1f577..80702440 100644 --- a/gui/Properties/AssemblyInfo.cs +++ b/gui/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // 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("1.2.5.0")] -[assembly: AssemblyFileVersion("1.2.5.0")] +[assembly: AssemblyVersion("1.2.6.0")] +[assembly: AssemblyFileVersion("1.2.6.0")] diff --git a/gui/packages.config b/gui/packages.config index 3514f741..4bd81e07 100644 --- a/gui/packages.config +++ b/gui/packages.config @@ -14,4 +14,9 @@ + + + + + \ No newline at end of file diff --git a/samples/UnrealEnginePlugin/OptickPlugin.uplugin b/samples/UnrealEnginePlugin/OptickPlugin.uplugin index 37dd4beb..9de00257 100644 --- a/samples/UnrealEnginePlugin/OptickPlugin.uplugin +++ b/samples/UnrealEnginePlugin/OptickPlugin.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "1.2.5", + "VersionName": "1.2.6", "FriendlyName": "Optick", "Description": "Super Lightweight Performance Profiler", "Category": "Performance", @@ -10,7 +10,6 @@ "DocsURL": "https://github.com/bombomby/optick", "MarketplaceURL": "", "SupportURL": "https://github.com/bombomby/optick/issues", - "EngineVersion" : "4.21.0", "EnabledByDefault": true, "CanContainContent": false, "IsBetaVersion": true,