Skip to content

Commit 5665e02

Browse files
committed
[v1.2.6] Adding support for error reporting through Sentry lib.
1 parent db4ce82 commit 5665e02

File tree

6 files changed

+64
-18
lines changed

6 files changed

+64
-18
lines changed

gui/App.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
x:Class="Profiler.App"
55
xmlns:local="clr-namespace:Profiler"
6-
x:Name="Optick">
6+
x:Name="Optick"
7+
DispatcherUnhandledException="Optick_DispatcherUnhandledException">
78
<Application.Resources>
89
<ResourceDictionary>
910
<ResourceDictionary.MergedDictionaries>

gui/App.xaml.cs

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
using System.Reflection;
44
using System.IO;
55
using System.Diagnostics;
6-
6+
using Sentry;
7+
78
namespace Profiler
89
{
910
/// <summary>
@@ -14,19 +15,42 @@ public partial class App : Application
1415

1516
static App()
1617
{
17-
//AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);
18-
}
19-
20-
//static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
21-
//{
22-
// return AutoEmbedLibs.EmbeddedAssembly.Get(args.Name);
23-
//}
18+
19+
}
2420

2521
protected override void OnStartup(StartupEventArgs e)
2622
{
27-
base.OnStartup(e);
28-
}
29-
30-
31-
}
23+
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
24+
base.OnStartup(e);
25+
}
26+
27+
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
28+
{
29+
Exception ex = e.ExceptionObject as Exception;
30+
ReportError(ex);
31+
}
32+
33+
private void Optick_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
34+
{
35+
e.Handled = ReportError(e.Exception);
36+
}
37+
38+
bool ReportError(Exception ex)
39+
{
40+
Exception rootException = ex;
41+
42+
while (rootException.InnerException != null)
43+
rootException = rootException.InnerException;
44+
45+
if (MessageBox.Show("Unhandled Exception:\n" + rootException.ToString(), "Optick Crashed! Send report?", MessageBoxButton.OKCancel, MessageBoxImage.Error) == MessageBoxResult.OK)
46+
{
47+
using (SentrySdk.Init("https://[email protected]/1493349"))
48+
{
49+
SentrySdk.CaptureException(rootException);
50+
}
51+
return true;
52+
}
53+
return false;
54+
}
55+
}
3256
}

gui/Optick.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@
175175
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
176176
</Reference>
177177
<Reference Include="PresentationFramework.Aero" />
178+
<Reference Include="Sentry, Version=1.2.0.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
179+
<HintPath>packages\Sentry.1.2.0\lib\net461\Sentry.dll</HintPath>
180+
</Reference>
181+
<Reference Include="Sentry.PlatformAbstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
182+
<HintPath>packages\Sentry.PlatformAbstractions.1.0.0\lib\net45\Sentry.PlatformAbstractions.dll</HintPath>
183+
</Reference>
184+
<Reference Include="Sentry.Protocol, Version=1.0.6.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
185+
<HintPath>packages\Sentry.Protocol.1.0.6\lib\net46\Sentry.Protocol.dll</HintPath>
186+
</Reference>
178187
<Reference Include="SharpDX">
179188
<HintPath>AutoEmbedLibs\SharpDX.dll</HintPath>
180189
</Reference>
@@ -191,10 +200,18 @@
191200
<HintPath>AutoEmbedLibs\SharpDX.DXGI.dll</HintPath>
192201
</Reference>
193202
<Reference Include="System" />
203+
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
204+
<HintPath>packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
205+
</Reference>
194206
<Reference Include="System.ComponentModel.DataAnnotations" />
195207
<Reference Include="System.Data" />
196208
<Reference Include="System.Drawing" />
197209
<Reference Include="System.Net.Http" />
210+
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
211+
<HintPath>packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
212+
<Private>True</Private>
213+
<Private>True</Private>
214+
</Reference>
198215
<Reference Include="System.Web" />
199216
<Reference Include="System.Windows" />
200217
<Reference Include="System.Windows.Forms" />

gui/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.2.5.0")]
55-
[assembly: AssemblyFileVersion("1.2.5.0")]
54+
[assembly: AssemblyVersion("1.2.6.0")]
55+
[assembly: AssemblyFileVersion("1.2.6.0")]

gui/packages.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net461" />
1515
<package id="MahApps.Metro" version="1.6.5" targetFramework="net461" />
1616
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
17+
<package id="Sentry" version="1.2.0" targetFramework="net461" />
18+
<package id="Sentry.PlatformAbstractions" version="1.0.0" targetFramework="net461" />
19+
<package id="Sentry.Protocol" version="1.0.6" targetFramework="net461" />
20+
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
21+
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
1722
</packages>

samples/UnrealEnginePlugin/OptickPlugin.uplugin

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
33
"Version": 1,
4-
"VersionName": "1.2.5",
4+
"VersionName": "1.2.6",
55
"FriendlyName": "Optick",
66
"Description": "Super Lightweight Performance Profiler",
77
"Category": "Performance",
@@ -10,7 +10,6 @@
1010
"DocsURL": "https://github.com/bombomby/optick",
1111
"MarketplaceURL": "",
1212
"SupportURL": "https://github.com/bombomby/optick/issues",
13-
"EngineVersion" : "4.21.0",
1413
"EnabledByDefault": true,
1514
"CanContainContent": false,
1615
"IsBetaVersion": true,

0 commit comments

Comments
 (0)