Releases: simpleinjector/SimpleInjector
Simple Injector v4.10.2
Release Notes
Simple Injector can be downloaded using NuGet.
NOTE: Due to a merging error, the NuGet package containing Simple Injector 4.10.0 and 4.10.1 are identical to that of Simple Injector 4.9.2.
This is a small minor release, which adds just some overloads to Container.Collection.Register
in the core library. See below for more details.
Improvements
Simple Injector core library
- #808 Added
Container.Collection.Register
overloads that accept aLifestyle
argument
Simple Injector v4.9.2
Release Notes
Simple Injector can be downloaded using NuGet.
Bug fixes
Simple Injector core library
- #807 Improved exception messages when an incomplete registration is encountered. More specifically, in some special cases,
RegisterConditional
registrations were not considered when constructing an exception message that warned about registrations with a similar naming.
Simple Injector v4.9.1
Release Notes
Simple Injector can be downloaded using NuGet.
Bug fixes
Simple Injector core library
- #414 Object graphs that consist of decorators with
Func<T>
decoratee factories are now visualized correctly. - #759 Object graphs that consist collections (e.g.
IEnumerable<T>
) are now visualized correctly.
ASP.NET Core Integration packages
- #802 Exception message improved that is thrown by the
SimpleInjectorControllerActivator
in case an unregistered controller is requested.
Simple Injector v4.9
Release Notes
Simple Injector can be downloaded using NuGet.
The most prominent improvements in this release are:
- Core library:
- Support for using
ReadOnlyCollection<T>
in the core library. - The container's Lifestyle Mismatch verification behavior can now be set to a less strict model allowing
Transient
dependencies to be injected intoScoped
consumers using theContainer.Options.UseLoosenedLifestyleMismatchBehavior
configuration switch.
- Support for using
- ASP.NET Core integration:
- The container is now automatically disposed on web application shutdown, unless overridden using
services.AddSimpleInjector(container, options => { options.DisposeContainerWithServiceProvider = false; })
. - Scoped
IAsyncDisposable
components, created by Simple Injector during the course of a web request, will now be automatically, and asynchronously disposed.
- The container is now automatically disposed on web application shutdown, unless overridden using
Improvements
Simple Injector core library
- #762 Support for resolving and injecting
ReadOnlyCollection<T>
collections added - #781 Reports existing interface registrations when
Options.ResolveUnregisteredConcreteTypes
is false - #793 Added option to loosen the Lifestyle Mismatch verification behavior.
ServiceCollection Integration package
- #787 The
Container
instance is now automatically appended to theIServiceCollection
to simplify some integration scenarios.
ASP.NET Core Integration packages
- #763 Allow Simple Injector container to be automatically disposed when integrated into ASP.NET Core
- #778 Added support for
IAsyncDisposable
. The ASP.NET Core integration package will now automatically do asynchronous disposal of scopedIAsyncDisposable
dependencies within the context of a web request. - #730 Fixed an invalid message in an
ObsoleteAttribute
- #794 Some obsoleted messages are now marked with
error: true
and now cause compile errors.
The following class members are now marked obsolete:
SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterMvcControllers(Container, IApplicationBuilder)
SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterMvcViewComponents(Container, IApplicationBuilder)
SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterMvcViewComponents(Container, IViewComponentDescriptorProvider)
SimpleInjectorAspNetCoreMvcIntegrationExtensions.AddSimpleInjectorTagHelperActivation
SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterPageModels
SimpleInjectorAspNetIntegrationExtensions.EnableSimpleInjectorCrossWiring(IServiceCollection, Container)
SimpleInjectorAspNetIntegrationExtensions.CrossWire<TService>(Container, IApplicationBuilder)
SimpleInjectorAspNetIntegrationExtensions.CrossWire(Container, Type, IApplicationBuilder)
SimpleInjectorAspNetIntegrationExtensions.AutoCrossWireAspNetComponents(Container, IApplicationBuilder)
SimpleInjectorAspNetIntegrationExtensions.AutoCrossWireAspNetComponents(Container, IServiceProvider)
SimpleInjectorUseOptionsAspNetCoreExtensions.UseMiddleware<TMiddleware>(SimpleInjectorUseOptions, IApplicationBuilder)
SimpleInjectorUseOptionsAspNetCoreExtensions. UseMiddleware(SimpleInjectorUseOptions, Type, IApplicationBuilder)
Simple Injector v4.8.1
Simple Injector v4.8
Release Notes
Simple Injector can be downloaded using NuGet.
The most prominent improvements in this release are:
- Full support for ASP.NET Core 3.
- The container can now perform verification on first resolve. This can be enabled using an option switch.
- The container now allows sending notifications to inform that the container is about to be locked.
- Several small improvements and bug fixes.
For the last few years, the development of ASP.NET Core has been in flux. We've seen breaking changes from release to release and we engaged in discussions with Microsoft about all kinds of issues and bugs that we came across. The introduction of ASP.NET Core v3 again caused some issues with Simple Injector. Those problems took us more time to analyze, discuss, design, test, document, and release.
Finally, in this release we now truly support ASP.NET Core 3. To pull this off, we had to mark quite a few methods as obsolete and replace them with new methods. For the most part, you can follow the compiler-generated obsolete messages that you get once you upgrade to v4.8. Or refer to the documentation, if freshly apply Simple Injector to an ASP.NET Core application.
Note that the v4.8 integration libraries can be used in ASP.NET Core v2 as well, and we advise ASP.NET Core v2 users to upgrade to Simple Injector v4.8 as well, because of the bug fixes we made, and to make it easier later on to migrate to ASP.NET Core v3.
The Container
can now perform verification on first resolve. We found that many developers that are new to Simple Injector don't realize that Simple Injector allows verifying the configuration. To mitigate this, v5.0 will automatically verify the container for you when you resolve your first component, in case you, or one of your team members, forgot to call Container.Verify()
. In this v4.8 release we add this feature, but leave it disabled by default to prevent any breaking changes. In v5 we will turn the switch. You can enable it by setting Container.Options.EnableAutoVerification
to true
or you can already set it to false to prevent verification in case you have your own safety net in place (e.g. by calling container.Verify()
inside a unit test).
We added a new event that you can subscribe and receive a notification when the container is about to get locked—this would typically happen when the first component gets resolved. This enables making last-minute registrations and allows spotting who is locking the container. The ASP.NET Core integration package is now the primary consumer of this event—it needs this notification to successfully integrate with ASP.NET Core v3.
Improvements
Simple Injector core library
- #555 Allowed performing verification upon first resolve. This feature can be enabled by setting
Container.Options.EnableAutoVerification = true;
. The value isfalse
by default, but this will change in v5. - #767 Added the
Container.ContainerLocking
event that signals when the container is about to get locked. - #441 Resolving an unregistered collection now throws an exception with a message that explains that collections need to be registered explicitly and how to solve the issue.
ServiceCollection Integration package
- #754 Added ASP.NET Core 3 support. To support ASP.NET Core 3, the following methods are added:
SimpleInjectorAddOptions.AutoCrossWireFrameworkComponents
property. Can be used from within theAddSimpleInjector
setup action.- New
CrossWire()
extension methods on top ofSimpleInjectorAddOptions
. They replace theCrossWire
extension methods on top ofSimpleInjectorUseOptions
. - New
AddLogging()
andAddLocalization()
extension methods on top ofSimpleInjectorAddOptions
. They replace theUseLogging()
andUseLocalization()
extension methods on top ofSimpleInjectorUseOptions
.
The following class members are now marked obsolete:
-
SimpleInjectorServiceCollectionExtensions
:UseLogging(SimpleInjectorUseOptions)
. You can callAddLogging(SimpleInjectorAddOptions)
instead as part of theAddSimpleInjector
setup action.UseLocalization(SimpleInjectorUseOptions)
. You can callAddLocalization(SimpleInjectorAddOptions)
instead as part of theAddSimpleInjector
setup action.CrossWire<TService>(SimpleInjectorUseOptions)
. You can callCrossWire<TService>(SimpleInjectorAddOptions)
instead as part of theAddSimpleInjector
setup action.CrossWire(SimpleInjectorUseOptions, Type)
. You can callCrossWire(SimpleInjectorAddOptions, Type)
instead as part of theAddSimpleInjector
setup action.
-
SimpleInjectorUseOptions
:AutoCrossWireFrameworkComponents
. Setting it has no effect any longer and using it will therefore cause a compile error. You can useSimpleInjectorAddOptions.AutoCrossWireFrameworkComponents
instead as part of theAddSimpleInjector
setup action.
ASP.NET Generic Host Integration package
- #754 Enabled hosted services to be integrated with Simple Injector and ASP.NET Core 3.
ASP.NET Core Integration packages
- #754 Added ASP.NET Core 3 support.
The following class members are now marked obsolete:
SimpleInjectorAspNetIntegrationExtensions
:EnableSimpleInjectorCrossWiring()
. A call to.AddSimpleInjector()
automatically enables cross wiring.CrossWire<TService>(Container, IApplicationBuilder)
. Instead of callingCrossWire
on theContainer
, you can now callCrossWire
onSimpleInjectorAddOptions
.CrossWire(this Container, Type, IApplicationBuilder)
. Instead of callingCrossWire
on theContainer
, you can now callCrossWire
onSimpleInjectorAddOptions
.AutoCrossWireAspNetComponents(Container, IApplicationBuilder)
. Auto cross wiring is automatically enabled when calling.AddSimpleInjector()
.AutoCrossWireAspNetComponents(Container, IServiceProvider)
. Auto cross wiring is automatically enabled when calling.AddSimpleInjector()
.
SimpleInjectorUseOptionsAspNetCoreExtensions
:UseMiddleware<TMiddleware>(SimpleInjectorUseOptions, IApplicationBuilder)
. This method can cause your middleware to be applied at the wrong stage in the pipeline. This will, for instance, cause your middleware to be executed before the static files middleware (i.e. the.UseStaticFiles()
call) or before authorization is applied (i.e. the.UseAuthorization()
call). Instead callapp.UseMiddleware<TMiddleware>(Container)
, and make sure you call it at the right stage. This typically means after.UseStaticFiles()
and.UseAuthorization()
, but before.UseEndpoints(...)
.UseMiddleware(SimpleInjectorUseOptions, Type, IApplicationBuilder)
. Same as previous. Callapp.UseMiddleware(Container, Type)
instead.
Bug fixes
ServiceCollection Integration package
- #713 Resolving cross-wired transient service outside of scope threw a too generic exception.
ASP.NET Core Integration packages
Simple Injector v4.7.2
Release Notes
Simple Injector can be downloaded using NuGet.
This is a patch release that fixes a bug that prevented the ASP.NET Core MVC integration package to be used in combination with ASP.NET Core v3 (#748).
Simple Injector v4.7.1
Release Notes
Simple Injector can be downloaded using NuGet.
This is a patch release that fixes a regression in the MVC integration package (#746).
Simple Injector v4.7
Release Notes
Simple Injector can be downloaded using NuGet.
The most prominent improvements in this release are:
- #649 Implemented C# 8.0 non-nullable support. This affects the core library and all integration packages. The complete API is now annotated in such way that C# 8 can warn you want you are possible using a null reference.
- Simplify integration with
IStringLocalizer
andIStringLocalizer<T>
while integrating with .NET Core. Thanks to contributor @kwlin for implementing this.
Improvements
Simple Injector core library
- #649 Implemented C# 8 non-nullable support
- #736 Marked [Obsolete] message as error
- #727 Added
GetService
method toScope
by implementingIServiceProvider
.
Usage:Scope scope = ...; IServiceProvider provider = scope; object? service = provider.GetService(typeof(SomeType));
ASP.NET Core Integration packages
- #717 Added non-generic
options.UseMiddleware
overload.
ServiceCollection Integration packages
Simple Injector v4.6.2
Release Notes
Simple Injector can be downloaded using NuGet.
Improvements
Simple Injector core library
- #731 ThreadAbortExceptions could cause the Container's internal state to get corrupt.
- #732 Diagnostic Analyzers did not respect
container.Options.UseFullyQualifiedTypeNames
- #719 Improved "The supplied list of types contains one or multiple open-generic types, but this method is unable to handle open-generic types" exception message
- #720 Improved XML documentation on
Container.Collection.Append
overloads.