Add Raygun reporting

This commit is contained in:
John Lewin 2015-05-20 13:37:08 -07:00
parent caec1c16ee
commit 155500710a
3 changed files with 36 additions and 2 deletions

View file

@ -340,6 +340,14 @@
<Compile Include="PrinterControls\PrinterConnections\PrinterSetupStatus.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Mindscape.Raygun4Net, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Mindscape.Raygun4Net.5.0.0\lib\net40\Mindscape.Raygun4Net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mindscape.Raygun4Net4, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Mindscape.Raygun4Net.5.0.0\lib\net40\Mindscape.Raygun4Net4.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -348,6 +356,10 @@
<HintPath>PdfSharp.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="Raygun.Diagnostics, Version=0.7.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Raygun.Diagnostics.0.7.3\lib\net45\Raygun.Diagnostics.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />

View file

@ -40,6 +40,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.RenderOpenGl.OpenGl;
using MatterHackers.VectorMath;
using Mindscape.Raygun4Net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -70,6 +71,8 @@ namespace MatterHackers.MatterControl
private string unableToExitTitle = "Unable to Exit".Localize();
private static RaygunClient _raygunClient = new RaygunClient("hQIlyUUZRGPyXVXbI6l1dA==");
static MatterControlApplication()
{
// Because fields on this class call localization methods and because those methods depend on the StaticData provider and because the field
@ -360,20 +363,37 @@ namespace MatterHackers.MatterControl
// Make sure we have the right working directory as we assume everything relative to the executable.
Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
//throw new Exception("Forced exception thrown manually!");
Datastore.Instance.Initialize();
#if !DEBUG
// Conditionally spin up error reporting if not on the Stable channel
string channel = UserSettings.Instance.get("UpdateFeedType");
if (string.IsNullOrEmpty(channel) || channel != "release")
if (string.IsNullOrEmpty(channel) || channel != "release" || OemSettings.Instance.WindowTitleExtra == "Experimental")
#endif
{
System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
MatterControlApplication app = MatterControlApplication.Instance;
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
_raygunClient.Send(e.Exception);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
_raygunClient.Send(e.ExceptionObject as Exception);
}
public static void WriteTestGCodeFile()
{
using (StreamWriter file = new StreamWriter("PerformanceTest.gcode"))

View file

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mindscape.Raygun4Net" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net45" />
<package id="Raygun.Diagnostics" version="0.7.3" targetFramework="net45" />
</packages>