Skip to content

Invoke configOptions callback directly to derive event binders during Maui init #4216

@jamescrosswell

Description

@jamescrosswell

For context see:

We can address all of Allan's concerns by using the second method from the benchmark fork:

case RegisterEventBinderMethod.InvokeConfigOptions:
var options = new SentryMauiOptions();
configureOptions?.Invoke(options);
services.TryAddSingleton<SentryOptions>(options); // Ensure this doesn't get resolved again in AddSentry
foreach (var eventBinder in options.DefaultEventBinders)
{
eventBinder.Register(services);
}
break;

That way people still setup the new integration as an extension on SentryOptions (i.e. from within the call to UseSentry) and we don't build a service provider to resolve the options. The time required to do this would be absolutely trivial, regardless of the container technology that people have chosen... and we can do this without creating any extra benchmarks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions