autofac / Autofac.ServiceFabric

Autofac integration for Azure Service Fabric. Provides service factory implementations for Actors, Stateful Services and Stateless Services.
MIT License
26 stars 27 forks source link

Allow use of current ILifetimeScope in the exception callback #47

Open RemcoBlok opened 5 years ago

RemcoBlok commented 5 years ago

Great to see the addition of the constructorExceptionCallback in release 2.1.0. I need to be able to resolve my logger instance in the callback. Is it possible to change the callback signature from Action<Exception> to Action<IComponentContext, Exception>?

tillig commented 5 years ago

It appears currently the callback is run after the lifetime scope is disposed so that will need to be updated. It'll also have to be safe such that if an exception is thrown during the callback the disposal of the scope will still be executed. It's simpler how it is now, which is not to say it's not possible to change, just that it's not "reorder the statements and call it good." Back compat is also a consideration, so we'll need overloads to handle it, not replacement of the existing thing.