[Breaking change]: Throw when resolving on a disposed service provider #26783
Labels
breaking-change
Indicates a .NET Core breaking change
🏁 Release: .NET 6
Issues and PRs for the .NET 6 release
source incompatible
Source code may encounter a breaking change in behavior when targeting the new version.
Uh oh!
There was an error while loading. Please reload this page.
Description
Resolving Services after ServiceProvider is Disposed should throw with
ObjectDisposedException
.PR: dotnet/runtime#45116
Version
.NET 6 RC 1
Previous behavior
Prior to the new change, if the application when through the rare case of resolving a service after service provider is disposed, it would lead to deadlock.
New behavior
Rather than deadlock, it will throw
ObjectDisposedException
.Type of breaking change
Reason for change
To unblock the deadlock scenario.
Recommended action
N/A
Feature area
C#, Core .NET libraries, Extensions
Affected APIs
IServiceProvider
GetService
orGetRequiredService
withDispose
usages in combination.The text was updated successfully, but these errors were encountered: