Releases: simpleinjector/SimpleInjector
Simple Injector v5.4.1
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.4.x release.
Fixes in this release:
- #956 Fixed memory leak caused by incorrect use of
ThreadLocal<bool>
.
Simple Injector v5.4
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.4.x release.
This minor release focuses around improved support for Flowing scopes and contains the following improvements and new features:
- #948 Array and List collection types can now be resolved in conjunction with Flowing scopes.
- #947 New
InstanceProducer.GetInstance(Scope)
overload was added to allow resolving instances from anInstanceProducer
in conjunction with Flowing scopes. - #949
DependencyMetadata<T>
can now be used in conjunction with Flowing scopes. - #951 Bug fix: The
IsClosedTypeOf
extension method would returnedtrue
when the the given type was open generic; this also impactedGetClosedTypeOf
andGetClosedTypesOf
.
Simple Injector v5.3.3
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.3.x release.
Fixes in this release:
- #925 Chaining identical decorators would result in a diagnostics error
Simple Injector v5.3.2
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.3.x release.
Changes in this release:
- #911 Fully qualified type names in exceptions where lookalikes exist
Simple Injector v5.3.1
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.3.x release.
This patch fixes a caching bug in GetRegistration
, which could cause a a call to GetRegistration
or GetService
to invalidly return null
.
- #909 A call to
GetRegistration(Type)
andGetRegistration<T>()
would returnnull
, even after that type was registered, whenGetRegistration
was called before that registration was made. - #909 A call to
GetService(Type)
would returnnull
instead of the registered service, when a call toGetRegistration
was made before the registration was made.
Simple Injector v5.3
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.3.x release.
This minor release contains the following improvements and new features:
- #897 Added a new convenient
Container.GetTypesToRegister<T>(IEnumerable<Assembly>, TypesToRegisterOptions)
overload. - #891
Container.GetRegistration<T>()
failed with cast exception. This generic overload was added in v5.0, but almost never worked. - #863 Loosened up locking behavior of
GetRegistration
. A call toGetRegistration
is now much less likely to cause the container to be locked. Thanks to @AroglDarthu for suggesting this. - #880 Allowed an existing
Scope
to be provided to aScopedLifestyle
to allow it to become the current active ambient scope. This feature was especially added for corner-case scenarios, such as Blazor integration. - #812 Improved exception messages caused by type initialization. TypeInitializationExcpetions, thrown by the .NET Framework are annoying and not very useful. When such exception is thrown while Simple Injector is resolving a type, Simple Injector will now transform the failure in a much more readable error message.
- #864 Improved the message of the Disposable-Transient-Component diagnostic warning. Thanks to @AroglDarthu for suggesting this.
Simple Injector v5.2.1
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.3.x release.
This patch fixes a concurrency bug that was introduced in v5.2.0 and impacts users of all builds except .NET Standard 2.1. All v5.2.0 users are advised to upgrade to this patch release.
- #883 Intermittently receiving IndexOutOfBoundsException from AsyncDisposableTypeCache.IsAsyncDisposable in 5.2.0
Simple Injector v5.2
This release is available through Nuget.
WARNING: There was a multi-threading bug introduced in this release that could impact most users. Please skip this release and upgrade to (at least) v5.2.1.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.3.x release.
This minor release implements the following work items:
- #873 Verification fails with
IAsyncDisposable
registrations - #867 Prevent
Microsoft.Bcl.AsyncInterfaces
dependency
The most important change in this minor release is #867, which solves the binding redirect issues that users have reported since the introduction of v5. This is done by removing the Microsoft.Bcl.AsyncInterfaces
NuGet package dependency (#867). Unfortunately, this forces the following breaking changes in the core library:
- [BREAKING] The
Scope.RegisterForDisposal(IAsyncDisposable)
method is removed and replaced with aScope.RegisterForDisposal(object)
overload. - [BREAKING] In the .NET Standard 2.0 and .NET 4.6.1 builds of Simple Injector,
Container
andScope
no longer implementIAsyncDisposable
effectively removingContainer.DisposeAsyc()
andScope.DisposeAsync()
from those builds.
These breaking changes were required because the removal of the Microsoft.Bcl.AsyncInterfaces
dependency disallows Simple Injector types to implement IAsyncDisposable
. Fortunately, unless you were calling DisposeAsync
yourself, an upgrade to Simple Injector v5.2 is likely a graceful one. For a more detailed discussion on what the problem was, please read our blog post.
The problem was urgent enough to force these breaking changes on a minor release, instead of making this into a major release, which takes much more planning and time.
NOTE: Do note that if you are using ASP.NET Core, you must upgrade the ASP.NET Core integration packages as well. The old packages will break with v5.2.
This doesn't mean, though, that asynchronous disposal isn't possible anymore. On the contrary actually. Where previous minor releases only allowed asynchronous disposal in the .NET 4.6.1, .NET Standard 2.0, and .NET Standard 2.1 builds of Simple Injector, asynchronous disposal is now supported in all builds. To make this possible, the following additions have been made:
- The pre-.NET Standard 2.1 builds of Simple Injector apply duck typing internally to recognize types that implement
IAsyncDisposable
. This means that Simple Injector checks if your type implements an interface named "System.IAsyncDisposable". Upon disposal, Simple Injector expects that interface to contain anDisposeAsync
method. That method should either returnTask
, orValueTask
. This means that you can either let your application depend onMicrosoft.Bcl.AsyncInterfaces
or define the interface yourself. As always, we ensured maximum performance; even this duck typing is blazingly fast. - The .NET Standard 2.1 build of Simple Injector skips duck typing and simply expects a asynchronous disposable type to implement the official
IAsyncDisposable
. .NET Standard 2.1 (which means you're either running .NET Core 3 or .NET 5) is provided out of the box. - A new
Task Container.DisposeContainerAsync()
method is added to allow disposing of theContainer
in an asynchronous fashion. - A new
Task Scope.DisposeScopeAsync()
method is add to allow disposing of theScope
in an asynchronous fashion. - A new
object[] Scope.GetAllDisposables()
method is added to allow retrieving all disposables instances that were created by aScope
. The list will return bothIDisposable
andIAsyncDisposable
implementations.
Simple Injector v5.1
This release is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.2.x release.
This minor release adds two new features to the core library:
- #857
Collection.Append
andCollection.Register
can now be called while supplying both a lifestyle and open generic implementations. - #861
DependencyMetadata<T>
can now be used in conjunction with Flowing scopes.
Thanks to @henriblMSFT for providing high-quality feature requests that made this possible.
Simple Injector v5.0.4
Simple Injector v5.0.4 is available through Nuget.
When upgrading from v4.x, please make sure you upgrade your application to the latest v4.x version of Simple Injector first. After that upgrade directly to the latest v5.2.x release.
This patch release fixes three bugs:
- #850 Conditional registrations can now be made when
AllowOverridingRegistrations
is set to true - #836 Conditionally register instances of the same type can now be registered (thanks to @kwlin)
- #859 When calling
Lifestyle.Singleton.CreateRegistration
using aFunc<object>
delegate, C# overload resolution would cause the incorrectCreateRegistration
overload to be called.