Skip to content

MAUI SentryAppBuilder #4208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ namespace Sentry.Maui;
/// <summary>
/// Methods to hook into MAUI and CommunityToolkit.Mvvm
/// </summary>
public static class SentryOptionsExtensions
public static class SentryMauiAppBuilderExtensions
{
/// <summary>
/// Automatically create traces for CommunityToolkit.Mvvm commands
/// </summary>
public static SentryMauiOptions AddCommunityToolkitIntegration(this SentryMauiOptions options)
{
options.AddDefaultEventBinder<MauiCommunityToolkitMvvmEventsBinder>();
return options;
}
public static SentryMauiAppBuilder AddCommunityToolkitIntegration(this SentryMauiAppBuilder builder)
=> builder.AddMauiElementBinder<MauiCommunityToolkitMvvmEventsBinder>();
}
15 changes: 0 additions & 15 deletions src/Sentry.Maui/MauiElementEventBinderRegistration.cs

This file was deleted.

23 changes: 23 additions & 0 deletions src/Sentry.Maui/SentryMauiAppBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Sentry.Maui;

/// <summary>
/// A builder for configuring Sentry in a .NET MAUI application.
/// </summary>
public class SentryMauiAppBuilder(IServiceCollection services)
{
/// <summary>
/// Access the current service collection
/// </summary>
public IServiceCollection Services => services;

/// <summary>
/// Configures the application by adding a binding for a Maui element of the specified implementation type.
/// </summary>
/// <typeparam name="TEventBinder">The type of implementation for the Maui element binder to be added.</typeparam>
/// <returns>The current instance of <see cref="SentryMauiAppBuilder"/> to allow method chaining.</returns>
public SentryMauiAppBuilder AddMauiElementBinder<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEventBinder>() where TEventBinder : class, IMauiElementEventBinder
{
Services.AddSingleton<IMauiElementEventBinder, TEventBinder>();
return this;
}
}
34 changes: 20 additions & 14 deletions src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,30 @@
/// </summary>
/// <param name="builder">The builder.</param>
/// <returns>The <paramref name="builder"/>.</returns>
public static MauiAppBuilder UseSentry(this MauiAppBuilder builder)
=> UseSentry(builder, (Action<SentryMauiOptions>?)null);
public static MauiAppBuilder UseSentry(this MauiAppBuilder builder, Action<SentryMauiAppBuilder>? configureAppBuilder = null)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Build (net9.0)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Build (net9.0)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 25 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, Action<SentryMauiAppBuilder>?)' (but other parameters do)
=> UseSentry(builder, (Action<SentryMauiOptions>?)null, configureAppBuilder);

/// <summary>
/// Uses Sentry integration.
/// </summary>
/// <param name="builder">The builder.</param>
/// <param name="dsn">The DSN.</param>
/// <returns>The <paramref name="builder"/>.</returns>
public static MauiAppBuilder UseSentry(this MauiAppBuilder builder, string dsn)
=> builder.UseSentry(o => o.Dsn = dsn);
public static MauiAppBuilder UseSentry(this MauiAppBuilder builder, string dsn, Action<SentryMauiAppBuilder>? configureAppBuilder = null)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Build (net9.0)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Build (net9.0)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-22.04)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)

Check failure on line 34 in src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-15)

Parameter 'configureAppBuilder' has no matching param tag in the XML comment for 'SentryMauiAppBuilderExtensions.UseSentry(MauiAppBuilder, string, Action<SentryMauiAppBuilder>?)' (but other parameters do)
=> builder.UseSentry(o => o.Dsn = dsn, configureAppBuilder: configureAppBuilder);

/// <summary>
/// Uses Sentry integration.
/// </summary>
/// <param name="builder">The builder.</param>
/// <param name="configureOptions">An action to configure the options.</param>
/// <param name="configureAppBuilder">Optional parameter that allows you to configure and add additional sentry services like MAUI element event binders</param>
/// <returns>The <paramref name="builder"/>.</returns>
public static MauiAppBuilder UseSentry(this MauiAppBuilder builder,
Action<SentryMauiOptions>? configureOptions)
public static MauiAppBuilder UseSentry(
this MauiAppBuilder builder,
Action<SentryMauiOptions>? configureOptions,
Action<SentryMauiAppBuilder>? configureAppBuilder = null
)
{
var services = builder.Services;

Expand All @@ -56,20 +60,22 @@
services.AddSingleton<IConfigureOptions<SentryMauiOptions>, SentryMauiOptionsSetup>();
services.AddSingleton<Disposer>();

services.TryAddSingleton<IMauiElementEventBinder, MauiButtonEventsBinder>();
services.TryAddSingleton<IMauiElementEventBinder, MauiImageButtonEventsBinder>();
services.TryAddSingleton<IMauiElementEventBinder, MauiGestureRecognizerEventsBinder>();
services.TryAddSingleton<IMauiElementEventBinder, MauiVisualElementEventsBinder>();
// Resolve the configured options and register any element event binders from these
IServiceProvider serviceProvider = services.BuildServiceProvider();
var options = serviceProvider.GetRequiredService<IOptions<SentryMauiOptions>>().Value;
services.TryAddSingleton<SentryOptions>(options); // Ensure this doesn't get resolved again in AddSentry
foreach (var eventBinder in options.DefaultEventBinders)
{
eventBinder.Register(services);
}

// This is ultimately the class that enables all the MauiElementEventBinders above
services.TryAddSingleton<IMauiEventsBinder, MauiEventsBinder>();

services.AddSentry<SentryMauiOptions>();

if (configureAppBuilder != null)
{
var appBuilder = new SentryMauiAppBuilder(services);
configureAppBuilder.Invoke(appBuilder);
}

builder.RegisterMauiEventsBinder();

return builder;
Expand Down
12 changes: 0 additions & 12 deletions src/Sentry.Maui/SentryMauiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ public SentryMauiOptions()
#if !PLATFORM_NEUTRAL
CacheDirectoryPath = Microsoft.Maui.Storage.FileSystem.CacheDirectory;
#endif
AddDefaultEventBinder<MauiButtonEventsBinder>();
AddDefaultEventBinder<MauiImageButtonEventsBinder>();
AddDefaultEventBinder<MauiGestureRecognizerEventsBinder>();
AddDefaultEventBinder<MauiVisualElementEventsBinder>();
}

internal List<IMauiElementEventBinderRegistration> DefaultEventBinders { get; } = [];

internal void AddDefaultEventBinder<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TEventBinder>()
where TEventBinder : class, IMauiElementEventBinder
{
DefaultEventBinders.Add(new MauiElementEventBinderRegistration<TEventBinder>());
}

/// <summary>
Expand Down
Loading