Skip to content

Commit

Permalink
[v1.2.6] Adding support for error reporting through Sentry lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
bombomby committed Aug 18, 2019
1 parent db4ce82 commit 5665e02
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 18 deletions.
3 changes: 2 additions & 1 deletion gui/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
50 changes: 37 additions & 13 deletions gui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
using System.Reflection;
using System.IO;
using System.Diagnostics;

using Sentry;

namespace Profiler
{
/// <summary>
Expand All @@ -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;
}
}
}
17 changes: 17 additions & 0 deletions gui/Optick.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework.Aero" />
<Reference Include="Sentry, Version=1.2.0.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
<HintPath>packages\Sentry.1.2.0\lib\net461\Sentry.dll</HintPath>
</Reference>
<Reference Include="Sentry.PlatformAbstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
<HintPath>packages\Sentry.PlatformAbstractions.1.0.0\lib\net45\Sentry.PlatformAbstractions.dll</HintPath>
</Reference>
<Reference Include="Sentry.Protocol, Version=1.0.6.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
<HintPath>packages\Sentry.Protocol.1.0.6\lib\net46\Sentry.Protocol.dll</HintPath>
</Reference>
<Reference Include="SharpDX">
<HintPath>AutoEmbedLibs\SharpDX.dll</HintPath>
</Reference>
Expand All @@ -191,10 +200,18 @@
<HintPath>AutoEmbedLibs\SharpDX.DXGI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
Expand Down
4 changes: 2 additions & 2 deletions gui/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
5 changes: 5 additions & 0 deletions gui/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@
<package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net461" />
<package id="MahApps.Metro" version="1.6.5" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
<package id="Sentry" version="1.2.0" targetFramework="net461" />
<package id="Sentry.PlatformAbstractions" version="1.0.0" targetFramework="net461" />
<package id="Sentry.Protocol" version="1.0.6" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
</packages>
3 changes: 1 addition & 2 deletions samples/UnrealEnginePlugin/OptickPlugin.uplugin
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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,
Expand Down

0 comments on commit 5665e02

Please sign in to comment.