v7.0.0
Version 7.0.0 is a major increment due to some changes in the target frameworks and some behavioral changes. We summarize these in the documentation, but included here as well:
New Features
- Properties marked
required
will now be injected by default. As part of this, the default property injector usingPropertiesAutowired()
will not inject properties markedrequired
. The documentation has more explanation with examples. - Ability to isolate
AssemblyLoadContext
by lifetime scope. A new method,BeginLoadContextLifetimeScope
, has been added that allows you to create a lifetime scope tied to a specificAssemblyLoadContext
. When the scope is disposed, Autofac will perform a best-effort release of all references to types from that context so the assemblies can be unloaded. The documentation explains this in greater detail. - Documentation links in exception messages. Common Autofac exceptions now include links to our online documentation to help you understand what the exceptions mean and how to troubleshoot them.
Issues and PRs
- Add documentation links to common exceptions by @tillig in #1359
- Fix #1360: Unify the "no constructors found" reporting by @tillig in #1362
- Add support for required properties by @alistairjevans in #1364
- Mark RegisterGeneratedFactory obsolete by @tillig in #1366
- Isolate service information computed in child scopes from the parent scope by @alistairjevans in #1350
Full Changelog: v6.5.0...v7.0.0
Breaking Changes
net50
no longer targeted. Autofac will still work with .NET 5 via thenetstandard2.1
target, but we recommend you upgrade to a later, supported version of .NET.- Properties marked
required
will now be injected by default. As noted above,required
properties will be injected. This is a behavioral change from Autofac 6.0. - Default property injection ignores
required
properties. UsingPropertiesAutowired()
will ignorerequired
properties because it's assumed they must be set during construction rather than post-object-creation. RegisterGeneratedFactory
is obsolete. This feature has been replaced by theFunc<X, Y, B>
built-in relationship and delegate factories.ILifetimeScope
has a newBeginLoadContextLifetimeScope
method. If you have mocks ofILifetimeScope
this method must now be implemented.