Giter VIP home page Giter VIP logo

Comments (8)

johnkattenhorn avatar johnkattenhorn commented on July 22, 2024

@alexmg, @tillig - any chance of getting this merged and released ?

from autofac.servicefabric.

alexmg avatar alexmg commented on July 22, 2024

Hi guys. Sorry, I've been away for the past few weeks and just got back today.

I assume this is to log the exception to another logging framework in addition to any existing ETW events that SF writes.

I think I prefer the RegisterServiceFabricSupport option to avoid having repeated boilerplate code on all service registrations.

In either case there would be an assumption that the logger implementation is available at the time of service registration (unless exposed using a static API like Serilog's Log class).

from autofac.servicefabric.

johnkattenhorn avatar johnkattenhorn commented on July 22, 2024

Yep, I see your point @alexmg, I'm cool with RegisterServiceFabricSupport, I'll submit another PR today if you like.

from autofac.servicefabric.

alexmg avatar alexmg commented on July 22, 2024

That would be awesome @johnkattenhorn. And thanks @fcastellscha and @EspenG for getting this started.

The new parameter should be optional and have a descriptive name like constructorExceptionCallback to indicate its scope of use is fairly limited.

We could also consider providing an options type to the RegisterServiceFabricSupport method with a default implementation that has an empty callback for the ConstructorExceptionCallback property.

from autofac.servicefabric.

alexmg avatar alexmg commented on July 22, 2024

Thinking about it a little, I don't think there will be enough options to warrant a whole new options type.

from autofac.servicefabric.

alexmg avatar alexmg commented on July 22, 2024

I pulled in the PR from @EspenG as a starting point for this and then refactored so that the action is provided to the RegisterServiceFabricSupport instead of each individual service registration.

I also made sure that the lifetime scope is proactively disposed when a constructor exception is thrown because the interceptor won't get the chance to do it.

from autofac.servicefabric.

alexmg avatar alexmg commented on July 22, 2024

These changes are currently on the MyGet feed in any 2.1.0 build if you would like to test them.

https://www.myget.org/F/autofac/api/v3/index.json

from autofac.servicefabric.

RemcoBlok avatar RemcoBlok commented on July 22, 2024

I need a way to resolve my logger in the callback. The callback is specified when configuring the container builder, but before the container is built. Is it possible to replace the Action<Exception> with Action<ILifetimeScope, Exception>. I can then use the ILifetimeScope to resolve my logger.
thanks

from autofac.servicefabric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.