Releases: seesharper/LightInject
v7.1.0
Change Log
v7.1.0 (05/21/2026)
Full Changelog
Merged Pull Requests
Align keyed service tests with MS.DI spec and fix AnyKey enumeration (05/21/2026) #613 (seesharper)
Summary
- Aligns
KeyedMicrosoftTests.cswith the upstreamKeyedDependencyInjectionSpecificationTests.csfrom dotnet/runtime - Fixes a bug where AnyKey (
"*") registrations were incorrectly included inIEnumerable<T>keyed service resolution - Bumps version to 7.1.0
Changes
Tests (KeyedMicrosoftTests.cs)
- Updated
ResolveKeyedServicesAnyKeyWithAnyKeyRegistration: expects 4 services (not 5); AnyKey registrations are excluded from enumeration - Updated
ResolveKeyedServicesSingletonInstanceWithAnyKey: AnyKey registrations are not included when listing services by a specific key - Updated
ResolveKeyedSingletonFromScopeServiceProviderandResolveKeyedScopedFromScopeServiceProvider: added assertions that direct AnyKey lookup throws - Added 13 new tests:
CombinationalRegistration,ResolveKeyedServicesAnyKeyConsistency,ResolveKeyedServicesAnyKeyConsistencyWithAnyKeyRegistration,ResolveKeyedServicesAnyKeyOrdering,ResolveWithAnyKeyQuery_Constructor,ResolveWithAnyKeyQuery_Constructor_Duplicates,ResolveWithAnyKeyQuery_InstanceProvided,ResolveWithAnyKeyQuery_InstanceProvided_Duplicates,ResolveRequiredKeyedServiceThrowsIfNotFound,SimpleServiceKeyedResolution
Fix (LightInject.cs)
In CreateEmitMethodForEnumerableServiceServiceRequest, two cases fixed (both variance and no-variance branches):
GetKeyedServices(AnyKey): added&& k.ServiceName != "*"so the"*"registration itself is not returnedGetKeyedServices("some-key"): removed|| k.ServiceName == "*"so AnyKey wildcard registrations don't appear in specific-key enumerations
Single-service resolution with AnyKey wildcard fallback is unaffected.
Test plan
- All 1561 tests pass
🤖 Generated with Claude Code
v7.0.2
Change Log
v7.0.2 (05/19/2026)
Full Changelog
Merged Pull Requests
Fixed issue #606: properly support named Lazy services (04/27/2025) #607 (kemsky)
Fixes issue #606.
I'm not entirely sure that all cases are covered, but tests passed and my issue is resolved.
Fix thread safety of disposableObjects in ServiceContainer.Dispose (05/19/2026) #611 (seesharper)
Summary
TrackInstanceandDispose()both accesseddisposableObjects(List<IDisposable>) without any synchronization, creating a data race under concurrent load — most visibly when services are still being first-resolved on background threads while the container is being disposed. Depending on .NET version and timing, this manifests asInvalidOperationException: Collection was modifiedorArgumentException: Destination array was not long enough.Dispose()also had no guard against the same instance being disposed more than once (e.g. if two container lifetimes happened to return the same object).
Changes
TrackInstance— wrapsdisposableObjects.Add()inlock(container.lockObject), matching the locking pattern already used byScope.TrackInstance.ServiceContainer.Dispose()— atomically snapshots-and-clearsdisposableObjectsunderlockObject, then disposes the snapshot outside the lock so no lock is held during userDispose()calls (avoids deadlocks). A reference-equalityHashSetskips duplicate entries, consistent with howScope.Dispose()already works.DisposableObjectComparer— new private nested class usingRuntimeHelpers.GetHashCodefor stable object-identity hashing.Dispose_ConcurrentWithServiceCreation_DoesNotThrow— stress test with 3 concurrent threads (2 resolving services, 1 disposing) over 1000 iterations as a regression guard.
Test plan
- All 1529 existing tests continue to pass
- New concurrent stress test passes under the fix
🤖 Generated with Claude Code
Bump version (05/19/2026) #612 (seesharper)
Closed Issues
v7.0.1
Change Log
v7.0.1 (11/19/2024)
Full Changelog
Merged Pull Requests
Removed unused usings (11/19/2024) #603 (seesharper)
Bump version (11/19/2024) #604 (seesharper)
Closed Issues
v7.0.0
Change Log
v7.0.0 (11/06/2024)
Full Changelog
Merged Pull Requests
Master (08/12/2023) #591 (oliverscode)
Fix test code errors
Fix typo in readme.md (08/15/2023) #592 (tompazourek)
Added compatibility with Microsoft.Extensions.DependencyInjection for keyed services. (11/06/2024) #599 (seesharper)
This PR adds the EnableMicrosoftCompatibility option which makes LightInject compatible with Microsoft.Extensions.DependencyInjection.
This includes support for keyed services which is now part of Microsoft.Extensions.DependencyInjection
Use Net8 and bumped all deps (11/06/2024) #601 (seesharper)
Closed Issues
- CanGetInstance throws System.ArgumentNullException when called with an unregistered serviceType and null serviceName (04/09/2024) #578 (mesakomarevich)
v6.6.4
Change Log
v6.6.4 (05/08/2023)
Full Changelog
Merged Pull Requests
Update LightInject.cs (01/01/2023) #584 (haavamoa)
Bugfix in GenericTypeMapper (05/08/2023) #588 (seesharper)
This PR fixes a bug that caused the GenericTypeMapper to return multiple candidates even if only one of the candidates actually implemented the requested service
Bump version number and dependencies (05/08/2023) #589 (seesharper)
Closed Issues
v6.6.3
Change Log
v6.6.3 (12/31/2022)
Full Changelog
Merged Pull Requests
Call Completed handler on Dispose and DisposeAsync (12/31/2022) #583 (seesharper)
v6.6.2
Change Log
v6.6.2 (12/29/2022)
Full Changelog
Merged Pull Requests
Added decorator test to prove that we can return without recorating (10/03/2022) #576 (seesharper)
Fixed issue #578 by setting serviceName to string.Empty if no registrations for the specified serviceType are found. (10/23/2022) #579 (mesakomarevich)
Fixed issue #578 and updated the unit tests that call CanGetInstance to cover null, empty, and whitespace values for the serviceName argument.
Bugfix dispose decorators as singleton (12/29/2022) #582 (seesharper)
Closed Issues
- Encountering IAsyncDisposable Error (10/11/2022) #577 (Mike-E-angelo)
v6.6.1
Change Log
v6.6.1 (09/19/2022)
Full Changelog
Merged Pull Requests
Only compile with asyncdisposable for netcoreapp3.1 and above (09/19/2022) #574 (seesharper)
This PR enables support for IAsyncDisposable ONLY for netcoreapp3.1 and above
Bumped to 6.6.1 (09/19/2022) #575 (seesharper)
Closed Issues
IAsyncDisposableSupport? (09/19/2022) #560 (Mike-E-angelo)- Stack overflow on v6.3.5+ (09/19/2022) #561 (sirphilliptubell)
v6.6.0
Change Log
v6.6.0 (09/12/2022)
Full Changelog
Merged Pull Requests
Disable nullable explicitly (09/12/2022) #572 (Pliner)
Hey,
We use LightInject(a source code package) as a built-in container for EasyNetQ.
We started a migration to Nullable Reference Types recently and observed build warnings because LightInject doesn't support them(and this is fine).
Could you consider adding #nullable disable pragma? It looks like the simplest way how these warnings could be suppressed.
Anyway, thanks for LightInject 🚀
Asyncdisposable (09/12/2022) #573 (seesharper)
This PR adds support for IAsyncDisposable
v6.5.2
Change Log
v6.5.2 (09/09/2022)
Full Changelog
Merged Pull Requests
Use UnderlyingSystemType for MakeGenericMethod (09/09/2022) #571 (seesharper)
