Skip to content

Releases: simpleinjector/SimpleInjector

Simple Injector v4.10.2

24 Apr 20:32
Compare
Choose a tag to compare

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 a Lifestyle argument

Simple Injector v4.9.2

08 Apr 15:50
Compare
Choose a tag to compare

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

06 Mar 14:13
Compare
Choose a tag to compare

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

06 Jan 16:21
Compare
Choose a tag to compare

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 into Scoped consumers using the Container.Options.UseLoosenedLifestyleMismatchBehavior configuration switch.
  • 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.

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 the IServiceCollection 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 scoped IAsyncDisposable 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

30 Nov 11:43
Compare
Choose a tag to compare

Release Notes

Simple Injector can be downloaded using NuGet.

Bug fixes

Simple Injector core library

  • #755 Improved a confusing Lifestyle Mismatch warning that went of when injecting a List<T> or array a Singleton.
  • #769 Fixed a false-positive Torn Lifestyle warning when using the forwarded collection registrations.

Simple Injector v4.8

24 Nov 14:43
Compare
Choose a tag to compare

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 is false 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 the AddSimpleInjector setup action.
    • New CrossWire() extension methods on top of SimpleInjectorAddOptions. They replace the CrossWire extension methods on top of SimpleInjectorUseOptions.
    • New AddLogging() and AddLocalization() extension methods on top of SimpleInjectorAddOptions. They replace the UseLogging() and UseLocalization() extension methods on top of SimpleInjectorUseOptions.

The following class members are now marked obsolete:

  • SimpleInjectorServiceCollectionExtensions:

    • UseLogging(SimpleInjectorUseOptions). You can call AddLogging(SimpleInjectorAddOptions) instead as part of the AddSimpleInjector setup action.
    • UseLocalization(SimpleInjectorUseOptions). You can call AddLocalization(SimpleInjectorAddOptions) instead as part of the AddSimpleInjector setup action.
    • CrossWire<TService>(SimpleInjectorUseOptions). You can call CrossWire<TService>(SimpleInjectorAddOptions) instead as part of the AddSimpleInjector setup action.
    • CrossWire(SimpleInjectorUseOptions, Type). You can call CrossWire(SimpleInjectorAddOptions, Type) instead as part of the AddSimpleInjector setup action.
  • SimpleInjectorUseOptions:

    • AutoCrossWireFrameworkComponents. Setting it has no effect any longer and using it will therefore cause a compile error. You can use SimpleInjectorAddOptions.AutoCrossWireFrameworkComponents instead as part of the AddSimpleInjector 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 calling CrossWire on the Container, you can now call CrossWire on SimpleInjectorAddOptions.
    • CrossWire(this Container, Type, IApplicationBuilder). Instead of calling CrossWire on the Container, you can now call CrossWire on SimpleInjectorAddOptions.
    • 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 call app.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. Call app.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

  • #750 Prevented TagHelper classes with __Generated__ in their name to be resolved from Simple Injector.
  • #761 AddTagHelperActivation incorrectly uses DefaultScopedLifestyle for tag helpers instead of Lifestyle.Transient.

Simple Injector v4.7.2

19 Sep 18:20
Compare
Choose a tag to compare

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

02 Sep 08:41
Compare
Choose a tag to compare

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

01 Sep 19:14
Compare
Choose a tag to compare

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 and IStringLocalizer<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 to Scope by implementing IServiceProvider.
    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

  • #718 Simplify integration with IStringLocalizer and IStringLocalizer<T> by adding an UseLocalization() extension method. Implemented by @kwlin.
    Usage:

    app.UseSimpleInjector(container, options =>
    {
        options.UseLocalization();
    });

Simple Injector v4.6.2

27 Jul 19:12
Compare
Choose a tag to compare

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.