diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs
index aa62e11a10be98..629b4f8c2542cb 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs
@@ -169,14 +169,26 @@ internal object GetRequiredKeyedService(Type serviceType, object? serviceKey, Se
internal bool IsDisposed() => _disposed;
- ///
+ ///
+ /// Disposes the service provider and all resolved services that implement .
+ ///
+ ///
+ /// Prefer calling over this method. If any resolved service implements
+ /// but not , this method throws an
+ /// . Use to properly handle all
+ /// disposable services, or explicitly perform sync-over-async on the caller side if synchronous
+ /// disposal is required.
+ ///
public void Dispose()
{
DisposeCore();
Root.Dispose();
}
- ///
+ ///
+ /// Asynchronously disposes the service provider and all resolved services that implement or .
+ ///
+ /// A value task that represents the asynchronous operation.
public ValueTask DisposeAsync()
{
DisposeCore();