Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,26 @@ internal object GetRequiredKeyedService(Type serviceType, object? serviceKey, Se

internal bool IsDisposed() => _disposed;

/// <inheritdoc />
/// <summary>
/// Disposes the service provider and all resolved services that implement <see cref="IDisposable"/>.
/// </summary>
/// <remarks>
/// Prefer calling <see cref="DisposeAsync"/> over this method. If any resolved service implements
/// <see cref="IAsyncDisposable"/> but not <see cref="IDisposable"/>, this method throws an
/// <see cref="InvalidOperationException"/>. Use <see cref="DisposeAsync"/> to properly handle all
/// disposable services, or explicitly perform sync-over-async on the caller side if synchronous
/// disposal is required.
Comment thread
rosebyte marked this conversation as resolved.
/// </remarks>
public void Dispose()
{
DisposeCore();
Root.Dispose();
}

/// <inheritdoc/>
/// <summary>
/// Asynchronously disposes the service provider and all resolved services that implement <see cref="IDisposable"/> or <see cref="IAsyncDisposable"/>.
/// </summary>
/// <returns>A value task that represents the asynchronous operation.</returns>
public ValueTask DisposeAsync()
{
DisposeCore();
Expand Down
Loading