diff --git a/CommonHelpers/CommonHelpers.csproj b/CommonHelpers/CommonHelpers.csproj
index 8f25536..7caa51c 100644
--- a/CommonHelpers/CommonHelpers.csproj
+++ b/CommonHelpers/CommonHelpers.csproj
@@ -7,9 +7,20 @@
enable
+
+
+
+
+
+
+
diff --git a/CommonHelpers/Instance.cs b/CommonHelpers/Instance.cs
index 5bfd3b7..dd8cbc8 100644
--- a/CommonHelpers/Instance.cs
+++ b/CommonHelpers/Instance.cs
@@ -1,6 +1,5 @@
using System.Security.Principal;
using System.Security.AccessControl;
-using AutoUpdaterDotNET;
using Microsoft.Win32;
using System.Diagnostics;
@@ -157,21 +156,30 @@ namespace CommonHelpers
}
}
+ public static void WithSentry(Action action)
+ {
+ using (Sentry.SentrySdk.Init(Log.SentryOptions))
+ {
+ action();
+ }
+ }
+
public static String MachineID
{
get
{
try
{
- using (var registryKey = Registry.CurrentUser.OpenSubKey(@"Software\SteamDeckTools"))
+ using (var registryKey = Registry.CurrentUser.OpenSubKey(@"Software\SteamDeckTools", true))
{
var machineID = registryKey?.GetValue("MachineID") as string;
- if (machineID is not null)
- return machineID;
+ if (machineID is null)
+ {
+ registryKey?.SetValue("MachineID", Guid.NewGuid().ToString());
+ machineID = registryKey?.GetValue("MachineID") as string;
+ }
- machineID = Guid.NewGuid().ToString();
- registryKey?.SetValue("MachineID", machineID);
- return machineID;
+ return machineID ?? "undefined";
}
}
catch (Exception)
diff --git a/CommonHelpers/Log.cs b/CommonHelpers/Log.cs
index 7dc5f77..0bbe9d9 100644
--- a/CommonHelpers/Log.cs
+++ b/CommonHelpers/Log.cs
@@ -1,9 +1,12 @@
using System.Diagnostics;
+using System.Reflection;
namespace CommonHelpers
{
public static class Log
{
+ internal const String SENTRY_DSN = "https://a6f1925b30fe43529aa7cefd0af7b8a4@o37791.ingest.sentry.io/4504316313993216";
+
#if DEBUG
private static bool LogToTrace = true;
#else
@@ -11,6 +14,22 @@ namespace CommonHelpers
#endif
private static bool LogToConsole = Environment.UserInteractive;
+ internal static void SentryOptions(Sentry.SentryOptions o)
+ {
+ o.Dsn = Log.SENTRY_DSN;
+ o.Environment = File.Exists("Uninstaller.exe") ? "setup_" : "zip_";
+ o.Environment += Instance.IsDEBUG ? "debug" : "release";
+ o.TracesSampleRate = 1.0;
+ o.IsGlobalModeEnabled = true;
+ o.DefaultTags.Add("MachineID", Instance.MachineID);
+
+ var releaseVersion = typeof(Log).Assembly.GetCustomAttributes().FirstOrDefault();
+ if (releaseVersion is not null)
+ {
+ o.Release = releaseVersion.InformationalVersion;
+ }
+ }
+
public static void TraceLine(string format, params object?[] arg)
{
if (!LogToTrace && !LogToConsole)
@@ -22,5 +41,14 @@ namespace CommonHelpers
if (LogToConsole)
Console.WriteLine(line);
}
+
+ public static void TraceException(String type, Exception e)
+ {
+ TraceLine("{0}: Exception: {1}", type, e);
+ Sentry.SentrySdk.CaptureException(e, scope =>
+ {
+ scope.SetTag("type", type);
+ });
+ }
}
}
diff --git a/FanControl/Program.cs b/FanControl/Program.cs
index 95e1f73..a447a9f 100644
--- a/FanControl/Program.cs
+++ b/FanControl/Program.cs
@@ -7,14 +7,16 @@ using LibreHardwareMonitor.Hardware;
using CommonHelpers;
namespace FanControl
-{
+{
internal class Program
{
static void Main(string[] args)
{
- ApplicationConfiguration.Initialize();
-
- Application.Run(new FanControlForm());
+ Instance.WithSentry(() =>
+ {
+ ApplicationConfiguration.Initialize();
+ Application.Run(new FanControlForm());
+ });
}
}
}
diff --git a/PerformanceOverlay/Program.cs b/PerformanceOverlay/Program.cs
index 95695f2..40eb031 100644
--- a/PerformanceOverlay/Program.cs
+++ b/PerformanceOverlay/Program.cs
@@ -1,3 +1,4 @@
+using CommonHelpers;
using RTSSSharedMemoryNET;
using System.Diagnostics;
@@ -8,12 +9,15 @@ namespace PerformanceOverlay
[STAThread]
static void Main()
{
- ApplicationConfiguration.Initialize();
-
- using (var controller = new Controller())
+ Instance.WithSentry(() =>
{
- Application.Run();
- }
+ ApplicationConfiguration.Initialize();
+
+ using (var controller = new Controller())
+ {
+ Application.Run();
+ }
+ });
}
}
}
\ No newline at end of file
diff --git a/PowerControl/Program.cs b/PowerControl/Program.cs
index 06f1c72..4e7afac 100644
--- a/PowerControl/Program.cs
+++ b/PowerControl/Program.cs
@@ -14,24 +14,27 @@ namespace PowerControl
[STAThread]
static void Main()
{
- if (Settings.Default.EnableExperimentalFeatures)
+ Instance.WithSentry(() =>
{
- for (int i = 0; !VangoghGPU.IsSupported; i++)
+ if (Settings.Default.EnableExperimentalFeatures)
{
- Instance.WithGlobalMutex(1000, () => VangoghGPU.Detect());
- if (VangoghGPU.IsSupported)
- Thread.Sleep(300);
+ for (int i = 0; !VangoghGPU.IsSupported; i++)
+ {
+ Instance.WithGlobalMutex(1000, () => VangoghGPU.Detect());
+ if (VangoghGPU.IsSupported)
+ Thread.Sleep(300);
+ }
}
- }
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
- ApplicationConfiguration.Initialize();
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
- using (var controller = new Controller())
- {
- Application.Run();
- }
+ using (var controller = new Controller())
+ {
+ Application.Run();
+ }
+ });
}
}
}
\ No newline at end of file
diff --git a/RELEASE.md b/RELEASE.md
index 1d8a9d9..b8d1aba 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -27,3 +27,4 @@
- Add `Updater.exe` that can update to latest release and debug
- Add `Setup.exe` installer to install all except RTSS
- Fix `Use X360 with Steam` that was broken with `0.5.33`
+- Add `Sentry` error tracking
diff --git a/SteamController/Program.cs b/SteamController/Program.cs
index a1a0bc2..f7a9798 100644
--- a/SteamController/Program.cs
+++ b/SteamController/Program.cs
@@ -1,3 +1,5 @@
+using CommonHelpers;
+
namespace SteamController
{
internal static class Program
@@ -8,14 +10,17 @@ namespace SteamController
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
- ApplicationConfiguration.Initialize();
-
- using (var controller = new Controller())
+ Instance.WithSentry(() =>
{
- Application.Run();
- }
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+
+ using (var controller = new Controller())
+ {
+ Application.Run();
+ }
+ });
}
}
}
diff --git a/Updater/Program.cs b/Updater/Program.cs
index afaa274..d010f14 100644
--- a/Updater/Program.cs
+++ b/Updater/Program.cs
@@ -17,6 +17,14 @@ namespace Updater
///
[STAThread]
static void Main()
+ {
+ Instance.WithSentry(() =>
+ {
+ Run();
+ });
+ }
+
+ static void Run()
{
bool firstRun = Environment.GetCommandLineArgs().Contains("-first");
bool userCheck = Environment.GetCommandLineArgs().Contains("-user");