diff --git a/src/WinDroid.Studio/App.xaml.cs b/src/WinDroid.Studio/App.xaml.cs
index 504f2ec..a48f469 100644
--- a/src/WinDroid.Studio/App.xaml.cs
+++ b/src/WinDroid.Studio/App.xaml.cs
@@ -1,4 +1,5 @@
using Microsoft.UI.Xaml;
+using Sentry;
namespace WinDroid.Studio;
@@ -7,16 +8,37 @@ namespace WinDroid.Studio;
///
public partial class App : Application
{
+ private readonly IDisposable _sentry;
private Window? _window;
public App()
{
+ _sentry = SentrySdk.Init(options =>
+ {
+ options.Dsn = Environment.GetEnvironmentVariable("SENTRY_DSN");
+
+#if DEBUG
+ options.Debug = true;
+#else
+ options.Debug = false;
+#endif
+
+ options.AutoSessionTracking = true;
+ });
+
InitializeComponent();
}
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
_window = new MainWindow();
+ _window.Closed += OnMainWindowClosed;
_window.Activate();
}
-}
+
+ private async void OnMainWindowClosed(object sender, WindowEventArgs args)
+ {
+ await SentrySdk.FlushAsync(TimeSpan.FromSeconds(2));
+ _sentry.Dispose();
+ }
+}
\ No newline at end of file
diff --git a/src/WinDroid.Studio/WinDroid.Studio.csproj b/src/WinDroid.Studio/WinDroid.Studio.csproj
index 206cacb..d0c10bc 100644
--- a/src/WinDroid.Studio/WinDroid.Studio.csproj
+++ b/src/WinDroid.Studio/WinDroid.Studio.csproj
@@ -22,6 +22,7 @@
+