Skip to content

Commit b97aec8

Browse files
Remove call to BuildServiceProvider when initialising Sentry.Maui (#4219)
Resolves #4216: - #4216
1 parent aae7342 commit b97aec8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Support musl on Linux ([#4188](https://github.com/getsentry/sentry-dotnet/pull/4188))
88
- Support for Windows ARM64 with Native AOT ([#4187](https://github.com/getsentry/sentry-dotnet/pull/4187))
9+
- Addressed potential performance issue with Sentry.Maui ([#4219](https://github.com/getsentry/sentry-dotnet/pull/4219))
910

1011
## 5.8.0
1112

src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ public static MauiAppBuilder UseSentry(this MauiAppBuilder builder,
5757
services.AddSingleton<Disposer>();
5858

5959
// Resolve the configured options and register any element event binders from these
60-
IServiceProvider serviceProvider = services.BuildServiceProvider();
61-
var options = serviceProvider.GetRequiredService<IOptions<SentryMauiOptions>>().Value;
62-
services.TryAddSingleton<SentryOptions>(options); // Ensure this doesn't get resolved again in AddSentry
60+
var options = new SentryMauiOptions();
61+
configureOptions?.Invoke(options);
6362
foreach (var eventBinder in options.DefaultEventBinders)
6463
{
6564
eventBinder.Register(services);

0 commit comments

Comments
 (0)