Repository navigation
Resolve Processors from ServiceProvider for Background Services in ASP.NET Core - #3476
jamescrosswell wants to merge 2 commits into
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Resolve Processors from ServiceProvider for Background Services in ASP.NET Core ([#3476](https://github.com/getsentry/sentry-dotnet/pull/3476))If none of the above apply, you can opt out of this check by adding |
This turns out to be much harder than I thought. For a start, some of these dependencies could be transient. Each transient dependency retrieved from the ServiceProvider will be, by definition, a separate instance (so the references won't match). Also, because we've effectively duplicated the activators that create instances in the If we were designing things from scratch, maybe we could tease the providers from here into separate Scoped and NonScoped providers: But as we have a public API that let's people add their own Event Processor Providers and they can add anything (scoped, transient or singleton) to that list, we have no way of knowing the lifetimes of the I thought of using the All in all, this seems to be the wrong approach and I don't have any other bright ideas. At this point, I'm starting to think we're better off recommending people register custom providers via the options rather than via the service provider directly. |
|
Thanks for the detailed writeup! |
Resolves GDX (view)
Currently WIP (sharing for comment).
It kind of works. I need to find a way to deduplicate these since the
Exceptthat is used currently only compares object references (which is too specific):sentry-dotnet/src/Sentry.AspNetCore/SentryMiddleware.cs
Lines 244 to 246 in 30bb7b4