Autofac v6.1.0 Release Notes

Release Date: 2020-12-04 // over 3 years ago
    • βž• Added direct support for .NET 5.
    • ⚑️ Internals update to allow more dynamic reconfiguration of resolve pipelines.
    • πŸ›  Fix #1204: Decorated instances marked with AllowCircularDependencies should now get properties injected correctly.
    • πŸ›  Fix #1226: Constructor binders correctly detect ref parameters.

Previous changes from v6.0.0

  • πŸ”– Version 6.0.0 represents a major update in the Autofac internals. While every effort has been made to ensure code using version 5.x will continue to work exactly as you expect, you should be aware of the breaking changes and test things out. For the majority case, things should just continue to work; breaking changes are primarily in more rare advanced usage scenarios.

    πŸ“š Check out the release blog post! Also, the documentation has been updated and is ready!

    🚚 > ⚠️ Starting with Autofac 6.0, we now only target netstandard20 and netstandard21; we have removed the explicit target for net461.

    πŸ“š > The impact to you is that, while Autofac will still work on .NET Framework 4.6.1 as it did before, we strongly encourage you to upgrade to .NET Framework 4.7.2 or higher, as per the .NET Standard Documentation, to avoid any of the known dependency issues when using .NET Standard packages in .NET Framework 4.6.1.

    πŸ†• New Features

    πŸ›  There are a lot of new features, but the big ones are here. Other features and fixes will be outlined in the Issues section, below.

    Issues and PRs

    The following issues have been addressed in v6:

    • πŸ‘ #718: Circular dependency support using property injection and relationships like Lazy<T> should now work.
    • πŸ“¦ #788: DOT graph support has been added via the Autofac.Diagnostics.DotGraph package.
    • πŸ›  #798 / #1148: Circular dependency handling uses the .NET runtime to check stack depth when checking for circular dependencies rather than using a fixed stack depth.
    • #828: The ILifetimeScope.LifetimeScopeEnding event is raised and completes before the scope is disposed.
    • πŸ‘ #970: The composite pattern is now supported.
    • #1069 / #1172: Core Autofac events are now async-friendly.
    • #1120 / #1128: ContainerBuilder is now sealed.
    • #1123: Explicitly injected properties can now be declared using an expression.
    • #1126 / #1169: Diagnostics are handled via DiagnosticSource.
    • πŸ“¦ #1162: A new "pooled" lifetime type has been added via the Autofac.Pooling package.

    πŸ’₯ Breaking Changes

    πŸ“š We'll do our best to keep an upgrade guide with breaking changes available and up to date. We're pretty sure we caught them all, but if you find a gotcha, let us know on the Documentation repo.

    A summary of the breaking changes is as follows:

    • net461 is no longer targeted ; Autofac now targets netstandard2.0 and netstandard2.1.
    • Activation events are no longer exposed - this all happens through middleware now.
      • If you were using an Autofac module to attach to activation events and inject parameters, similar to the way the log4net module example is shown in the document, this now needs to happen through middleware. The log4net module example has been updated to show you the new way it works.
      • RegistrationBuilder.RegistrationData no longer exposes activation handlers. The CoreEventMiddleware is the source of events now.
      • IComponentRegistration no longer exposes activation events. The CoreEventMiddleware is the source of events now.
    • Interface changes :
      • IConstructorSelector implementations need to switch to use BoundConstructor instead of ConstructorParameterBinding.
      • IRegistrationSource implementations need to update the RegistrationsFor method signature.
      • IInstanceActivator implementations no longer have an ActivateInstance method and instead have a ConfigurePipeline method.
      • IComponentRegistry no longer supplies a DecoratorsFor method to check decorators. Use IComponentRegistry.ServiceMiddlewareFor instead.
      • The ResolveRequest constructor now takes a ServiceRegistration instead of an IComponentRegistration.
    • ContainerBuilder is now sealed.

    Still Todo

    πŸ“¦ We're working hard to get all of the ~25 integration packages pushed to NuGet as quickly as we can, so please bear with us while we get these sorted.

    πŸ“¦ Some of this is sitting in branches ready to go, other things need to be done now that we have this core package out there.

    If your favorite integration isn’t ready yet, we’re doing our best. Rather than filing "When will this be ready?" issues, consider pull requests with the required updates.