NServiceBus Global exception handler


Is there a way I can implement a global exception handler, similar to that of Asp.net Core. I want to log my exception to Sentry.

I this to log only after the retry mechanism is going to move the message to the error queue. I have seen the .Failed in the recoverability.

How can I resolve dependencies inside the .Failed

You can subscribe to the Error Notifications to get notified when a message is being retried or sent to the error queue: https://docs.particular.net/nservicebus/recoverability/subscribing-to-error-notifications

How to resolve dependencies inside those handlers?

You could resolve them in the class that is doing the subscription and include a closure around them from within the actions.