Closed
Description
Description
Resolving Services after ServiceProvider is Disposed should throw with ObjectDisposedException
.
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
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
- Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.
Reason for change
To unblock the deadlock scenario.
Recommended action
N/A
Feature area
C#, Core .NET libraries, Extensions
Affected APIs
IServiceProvider
GetService
or GetRequiredService
with Dispose
usages in combination.