Skip to content

Commit 1f11fbc

Browse files
committed
Try to add Sentry without SDK, see : getsentry/sentry-dotnet#2614
1 parent 39741cd commit 1f11fbc

File tree

5 files changed

+49
-24
lines changed

5 files changed

+49
-24
lines changed

ImgTagFanOut/Dao/ImgTagFanOutDbContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Threading;
2-
using System.Threading.Tasks;
31
using Microsoft.EntityFrameworkCore;
42

53
namespace ImgTagFanOut.Dao;

ImgTagFanOut/Dao/ParameterDao.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.ComponentModel.DataAnnotations;
32
using System.Diagnostics;
43

ImgTagFanOut/ImgTagFanOut.csproj

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,46 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<Folder Include="Migrations\"/>
15-
<AvaloniaResource Include="Assets\**"/>
14+
<Folder Include="Migrations\" />
15+
<AvaloniaResource Include="Assets\**" />
1616
<Folder Include="Models\CompareAlgorithms\" />
1717
</ItemGroup>
1818

1919

2020
<ItemGroup>
21-
<PackageReference Include="Avalonia" Version="11.0.4"/>
22-
<PackageReference Include="Avalonia.Desktop" Version="11.0.4"/>
23-
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4"/>
24-
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.4"/>
21+
<PackageReference Include="Avalonia" Version="11.0.4" />
22+
<PackageReference Include="Avalonia.Desktop" Version="11.0.4" />
23+
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4" />
24+
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.4" />
2525
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
26-
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.4"/>
27-
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.4"/>
28-
<PackageReference Include="DynamicData" Version="7.14.2"/>
26+
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.4" />
27+
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.4" />
28+
<PackageReference Include="DynamicData" Version="7.14.2" />
2929
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
3030
<PrivateAssets>all</PrivateAssets>
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3232
</PackageReference>
33-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10"/>
33+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
3434
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3636
<PrivateAssets>all</PrivateAssets>
3737
</PackageReference>
38-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10"/>
38+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10" />
3939
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
4040
<PrivateAssets>all</PrivateAssets>
4141
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
4242
</PackageReference>
43-
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.6"/>
44-
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.6"/>
45-
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.6"/>
46-
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.6"/>
43+
<PackageReference Include="Sentry" Version="3.39.1" />
44+
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.6" />
45+
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.6" />
46+
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.6" />
47+
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.6" />
4748
</ItemGroup>
4849

4950

5051
<ItemGroup>
51-
<None Remove="NoPreview.png"/>
52-
<EmbeddedResource Include="NoPreview.png"/>
52+
<None Remove="NoPreview.png" />
53+
<EmbeddedResource Include="NoPreview.png" />
5354
<EmbeddedResource Update="Resources\Resources.resx">
5455
<Generator>PublicResXFileCodeGenerator</Generator>
5556
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

ImgTagFanOut/Program.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Avalonia;
22
using Avalonia.ReactiveUI;
33
using System;
4-
using System.IO;
5-
using System.Reflection;
6-
using Avalonia.Dialogs;
4+
using System.Reactive;
5+
using ReactiveUI;
6+
using Sentry;
77

88
namespace ImgTagFanOut;
99

@@ -24,6 +24,34 @@ public static AppBuilder BuildAvaloniaApp() =>
2424
{
2525
UseDBusFilePicker = false // to disable FreeDesktop file picker
2626
})
27+
.AfterSetup(_ =>
28+
{
29+
SentrySdk.Init(o =>
30+
{
31+
// Tells which project in Sentry to send events to:
32+
o.Dsn = "https://2fd61307fdf9b3a63804db34c9bc51eb@o4505868956860416.ingest.sentry.io/4505869112639488";
33+
// When configuring for the first time, to see what the SDK is doing:
34+
o.Debug = true;
35+
36+
// This option is recommended. It enables Sentry's "Release Health" feature.
37+
o.AutoSessionTracking = true;
38+
39+
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
40+
// We recommend adjusting this value in production.
41+
o.TracesSampleRate = 1.0;
42+
});
43+
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) =>
44+
{
45+
if (e.ExceptionObject is Exception ex)
46+
{
47+
SentrySdk.CaptureException(ex);
48+
}
49+
};
50+
RxApp.DefaultExceptionHandler = Observer.Create<Exception>(e =>
51+
{
52+
SentrySdk.CaptureException(e);
53+
});
54+
})
2755
.WithInterFont()
2856
.LogToTrace()
2957
.UseReactiveUI();

ImgTagFanOut/Views/MainWindow.axaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Threading.Tasks;
2-
using Avalonia.Controls;
32
using Avalonia.ReactiveUI;
43
using ImgTagFanOut.ViewModels;
54
using ReactiveUI;

0 commit comments

Comments
 (0)